flat = na flat := not inLongPosition and not inShortPosition
alertcondition(goLong and (inShortPosition or flat),title='Alert Long', message='Long') alertcondition(goShort and (inLongPosition or flat),title='Alert Short', message='Short!')
plotshape(goLong and (inShortPosition or flat), title='Long', location=location.abovebar, style=shape.labelup,textcolor=white, color=green, text="[LONG]", transp=0,offset=Offset) plotshape(goShort and (inLongPosition or flat),title='Short',location=location.belowbar, style=shape.labelup, textcolor=white, color=red, text="[SHORT]", transp=0,offset=Offset)
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.