问题描述
我正在尝试用颜色填充标准差之间的区域,但出现此错误:
line 24: Cannot call 'fill' with arguments (series[float],series[float],color=const color); available overloads: fill(hline,hline,series[color],input integer,const string,const bool,string) => void; fill(plot,plot,string) => void
我尝试了设置值和变量图的各种组合,但无法弄清楚我做错了什么。任何帮助表示赞赏。
//@version=4
study("My Script",overlay = true
hRange1 = close + stdev(close,5)
hRange2 = close + (stdev(close,5)*2)
hRange3 = close + (stdev(close,5)*3)
lRange1 = close - stdev(close,5)
lRange2 = close - (stdev(close,5)*2)
lRange3 = close - (stdev(close,5)*3)
plot(hRange1,style=plot.style_stepline)
plot(hRange2,style=plot.style_stepline)
plot(hRange3,style=plot.style_stepline)
plot(lRange1,style=plot.style_stepline)
plot(lRange2,style=plot.style_stepline)
plot(lRange3,style=plot.style_stepline)
fill(hRange1,hRange2,color=color.green)
解决方法
fill()可以在两个线或两个图之间填充。您的代码无效,因为您试图填充两个系列(hRange1和hRange2)之间的空间,而不是绘制这些系列的绘图。为了使您的代码正常工作,请具体参考打印对象,例如:
p1 = plot(hRange1,style=plot.style_stepline)
p2 = plot(hRange2,style=plot.style_stepline)
fill(p1,p2,color=color.green)