Pine脚本-无法在RSI指标自定义代码的BB指标中将源添加为RSI

问题描述

我想在RSI上添加Bolinger Band

我已经完成了以下代码,但是我不断收到错误消息

据我所知,ibbsrc就是问题所在

// @version=4
study(title="RSI - BB",shorttitle="RSI-BB",format=format.price,precision=2)

//          RSI             //

len = input(14,minval=1,title="RSI Length")
rsisrc = input(close,"RSI Source",type = input.source)
up = rma(max(change(rsisrc),0),len)
down = rma(-min(change(rsisrc),len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsi1 = plot(rsi,"RSI",color=#ffa726)
band1 = hline(60,"RSI Upper Band",color=#C0C0C0)
band2 = hline(50,"RSI Middle Band",color=#C0C0C0)
band0 = hline(40,"RSI Lower Band",color=#C0C0C0)
fill(band1,band0,color=#ffa726,transp=92,title="RSI Background")

//          BB             //

length = 20
ibbsrc = rsi1
mult = 2
basis = sma(ibbsrc,length)
dev = mult * stdev(ibbsrc,length)
upper = basis + dev
lower = basis - dev
offset = input(0,"IBB Offset",type = input.integer,minval = -500,maxval = 500)
plot(basis,"IBB Basis",color=#872323,offset = offset)
p1 = plot(upper,"IBB Upper",color=color.teal,offset = offset)
p2 = plot(lower,"IBB Lower",offset = offset)
fill(p1,p2,title = "IBB Background",color=#198787,transp=95)

当我这样做时出现以下错误

    Add to Chart operation Failed,reason: 
    -line 69: Cannot call 'sma' with arguments (plot,const integer); available overloads: sma(series[float],series[integer]) => series[float];
    -line 70: Cannot call 'stdev' with arguments (plot,const integer); available overloads: stdev(series[float],integer) => series[float];
    -line 71: Undeclared identifier 'basis';
    -line 71: Undeclared identifier 'dev';
    -line 72: Undeclared identifier 'basis';
    -line 72: Undeclared identifier 'dev';
    -line 74: Undeclared identifier 'basis';
    -line 75: Undeclared identifier 'upper';
    -line 76: Undeclared identifier 'lower'

请帮助我解决问题!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)