indicator("sigbars")
study("Significant Bar gku", shorttitle="Significant Bar", overlay=false)
length=input(14, "length")
ThreshStrong = input(2, "Strong Significant Bar")
ThreshWeak = input(1.4, "Weak Significant Bar")
TrueRange = at.tr
ATR = atr(length)
strongSB = tr > ATR*ThreshStrong
weakSB = tr > ATR*ThreshWeak
cold1=white
cold2=#b2ebf2
color = strongSB ? cold1 : weakSB ? cold2 : na
band1 = hline(ThreshStrong, "Upper Band", color=#C0C0C0)
band0 = hline(ThreshWeak, "Lower Band", color=#C0C0C0)
fill(band1, band0, color=#9915FF, transp=90, title="Background")
plot(tr, "true range", blue)
plot(ATR, "ATR", black)
plot(tr/ATR,"TR/ATR", red, style = histogram)
//plot(ma,"ma(TR/ATR)", green)
barcolor(color)
plot(close)
我从一位程序员那里抄袭了这段代码,但它似乎对我不起作用;我的经验非常有限,所以我运气不好,希望有人能给我指明正确的方向-
我一直得到以下错误9:18:39 AM -编译错误。第9行:输入“TrueRange”时的语法错误
发布于 2022-10-31 07:30:13
这是你的密码
//@version=5
indicator("Significant Bar gku", shorttitle="Significant Bar", overlay=false)
length=input(14, "length")
ThreshStrong = input(2, "Strong Significant Bar")
ThreshWeak = input(1.4, "Weak Significant Bar")
TrueRange = ta.tr
ATR = ta.atr(length)
strongSB = ta.tr > ATR*ThreshStrong
weakSB = ta.tr > ATR*ThreshWeak
cold1=color.white
cold2=#b2ebf2
color = strongSB ? cold1 : weakSB ? cold2 : na
band1 = hline(ThreshStrong, "Upper Band", color=#C0C0C0)
band0 = hline(ThreshWeak, "Lower Band", color=#C0C0C0)
fill(band1, band0, color=#9915FF, transp=90, title="Background")
plot(ta.tr, "true range", color.blue)
plot(ATR, "ATR", color.black)
plot(ta.tr/ATR,"TR/ATR", color.red, style = plot.style_histogram)
//plot(ma,"ma(TR/ATR)", green)
barcolor(color)
plot(close)
https://stackoverflow.com/questions/74249281
复制相似问题