【发布时间】:2019-12-27 15:40:30
【问题描述】:
我正在触发两个单独的警报条件(发生交叉和交叉时)
他们在此警报后跨越了几次,并多次触发它。我希望设置一个条件,以便他们一旦完成它就不再触发警报条件,直到触发另一个警报条件
aka alertcondition(long...) 仅触发一次,即使其条件再次发生但在触发 alertcondition(short...) 后条件恢复,反之亦然
long = crossover(RSIMain,SellAlertLevel)
short = crossunder(RSIMain,BuyAlertLevel)
alertcondition(long, title='BUY', message='BUY!')
alertcondition(short, title='SELL', message='SELL!')
plotshape(long, style=shape.arrowup, text="Long", color=green, location=location.belowbar, size=size.auto)
plotshape(short, style=shape.arrowdown, text="Short", color=red, location=location.abovebar, size=size.auto)
isLongOpen = false
isShortOpen = false
然后在代码的底部:
if (long)
isLongOpen := true
isShortOpen := false
if (short)
isShortOpen := true
isLongOpen := false
alertcondition((long and not isLongOpen), title....)
plotshape((long and not isLongOpen), title....)
【问题讨论】:
标签: pine-script