我正在尝试实施一个这个问题的答案 https://stackoverflow.com/a/73437787/2229856,但不知何故没有显示标签,也没有显示任何错误消息。在此代码之外,所有标签都会显示,因此label.new()
实例本身运行良好。
我做错了什么?
var label HighRSILabel = na
if(rsi > 70)
if(na(HighRSILabel)) //Does not exist, create one
HighRSILabel := label.new(bar_index, high, color=color.orange, text="RSI", textcolor=color.black, tooltip="RSI > 70", style=label.style_label_down)
else
label.set_x(HighRSILabel, bar_index)
Are you sure your symbol(e.g. BTCUSD) ever hit 70 rsi? Because if it never hit 70 rsi no label will be created. I tried your code with the symbol DOTEUR (1day) and it works as it should.
You can use tradingviews "<<Replay" function to see how the label moves through time for easier debugging.
这是代码:
//@version=5
indicator("rsi last")
var label HighRSILabel = na
rsi = ta.rsi(close, 10)
plot(rsi)
hline(70)
hline(30)
if(rsi > 70)
if(na(HighRSILabel)) //Does not exist, create one
HighRSILabel := label.new(bar_index, rsi, color=color.orange, text="RSI", textcolor=color.black, tooltip="RSI > 70", style=label.style_label_down)
else
label.set_x(HighRSILabel, bar_index)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)