# if long position open, jump to updateLong mark - if short position open, jump to updateShort mark 
check=pos iflong=updateLong ifshort=updateShort
# if we are here we know no position is open, abort alert (alternatively use do=main if you want to continue there instead) 
do=abort
 
:updateLong
# update your existing long TP/SL or similar here 
# (insert cancel order / close position etc) 
cancel=order id=SL,TP
close=pos side=long stoploss=-YOUR_STOP_LOSS% type=market expect=1 error=closeside retries=10 id=SL #notify=discord:"`SL at   \z` {stop}" 
close=pos side=long takeprofit=+0.5% price=+YOUR_TAKE_PROFIT% expect=1 error=closeside retries=10 id=TP #notify=discord:"`TP at   \z` {price}" 
 
# we continue with main order (alternatively use do=abort to just exit alert here) 
goto=main
 
:updateShort
# update your existing short TP/SL or similar here 
# (insert cancel order / close position etc) 
cancel=order id=SL,TP
close=pos side=short stoploss=+YOUR_STOP_LOSS% type=market expect=1 error=closeside retries=10 id=SL #notify=discord:"`SL at   \z` {stop}" 
close=pos side=short takeprofit=-0.5% price=-YOUR_TAKE_PROFIT% expect=1 error=closeside retries=10 id=TP #notify=discord:"`TP at   \z` {price}" 
 
# we continue with main order (alternatively use do=abort to just exit alert here) 
goto=main
 
:main
# do something general here if required 



Note: Instead of the above you can also use a much simpler alert using UNIFIED syntax with [side] placeholders – then activate the “Detect Side” checkbox for the PV Alert!

Attention

Always double check that you are using the right syntax/alert!