如果当前满足条件,则等待下一个警报信号
wait for the next alert signal if the conditions are currently met
当红色条的高点被打破时,我正在发出警报以通知我。
如果我在最后一个红色条还没有被打破时设置闹钟,闹钟就会正常工作..
但问题是:
如果我在最后一个红色已经被打破时设置警报,警报将立即触发。
如果我们已经高于最后一个红色条高点,是否有方法编写警报以等待下一个红色被打破?
谢谢。
这是代码
redCandle = barstate.isconfirmed and open>close
redcandlehigh= ta.valuewhen(redCandle,high,0)
GreenBarBroke= open < close and close>redcandlehigh
alertcondition(GreenBarBroke, title='Green', message='Green broke')
检查价格开盘价是否低于红色柱高,这样您就知道价格突破了该柱的高位。
//@version=5
indicator("My script", overlay=true)
var float last_red_high = na
is_green = close >= open
is_red = not is_green
last_red_high := is_red ? high : last_red_high
is_red_high_broken = (open < last_red_high) and (close > last_red_high)
plot(last_red_high, "Last Red High", color.yellow, 2, plot.style_circles)
plotshape(is_red_high_broken, "Red High Broken", shape.xcross, location.abovebar, color.white)
alertcondition(is_red_high_broken, "Red High Broken")
白色的“x”是您的警报将被触发的地方。
当红色条的高点被打破时,我正在发出警报以通知我。 如果我在最后一个红色条还没有被打破时设置闹钟,闹钟就会正常工作..
但问题是: 如果我在最后一个红色已经被打破时设置警报,警报将立即触发。
如果我们已经高于最后一个红色条高点,是否有方法编写警报以等待下一个红色被打破?
谢谢。
这是代码
redCandle = barstate.isconfirmed and open>close
redcandlehigh= ta.valuewhen(redCandle,high,0)
GreenBarBroke= open < close and close>redcandlehigh
alertcondition(GreenBarBroke, title='Green', message='Green broke')
检查价格开盘价是否低于红色柱高,这样您就知道价格突破了该柱的高位。
//@version=5
indicator("My script", overlay=true)
var float last_red_high = na
is_green = close >= open
is_red = not is_green
last_red_high := is_red ? high : last_red_high
is_red_high_broken = (open < last_red_high) and (close > last_red_high)
plot(last_red_high, "Last Red High", color.yellow, 2, plot.style_circles)
plotshape(is_red_high_broken, "Red High Broken", shape.xcross, location.abovebar, color.white)
alertcondition(is_red_high_broken, "Red High Broken")
白色的“x”是您的警报将被触发的地方。