我的指示灯触发报警,即使它不满足报警条件



我的指标

我有一个指示灯可以发出信号。工作逻辑是,如果背景是浅红色,价格触及蓝条,则发出空头信号。正如你在图片中看到的,没有信号,因为

plot(long_short==-1 ? shortStop : na, style=plot.style_linebr, color=color.yellow, linewidth=3, title="Short Fixed SL")
plot(long_short==-1 ? shortTake : na, style=plot.style_linebr, color=color.blue, linewidth=3, title="Short Fixed TP")
...
alertcondition(condition=short_last, title="Short Alarm", message='Open a Short Trade @ ${{close}}')
...
if(short_last)
l = label.new(bar_index, high)
label.set_text(l, "sell@n"+str.tostring(close))
label.set_color(l, color.red)
label.set_yloc(l, yloc.abovebar)
label.set_style(l, label.style_arrowdown)

如果short_last为true,那么它应该有tp/sl行和左侧信号中的标签,但它不存在,因为short_last必须为false。换句话说,它实际上不应该抛出一个信号。问题出在哪里?我该如何解决?

我发现了问题的原因。在Tradingview中添加报警时,会根据指示器的默认输入进行添加。我后来更改了输入,但由于警报仍按默认值显示,它实际上显示为另一个输入的浅红色区域,这就是它触发警报的原因。现在我必须再次设置40个警报。

最新更新