我正在触发两个单独的警报条件(发生交叉和越界时)
此警报发出后,他们经过了几次,并多次触发。我希望设置一个条件,以便一旦他们完成操作,它将不再触发警报条件,直到另一个警报条件被触发
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....)