# if long position open, jump to updateLong mark - if short position open, jump to updateShort mark - otherwise just exit the alert 
ifnopos=abort iflong=updateLong ifshort=updateShort
 
:updateLong
# update your existing long TP/SL or similar here 
cancel id=SL,TP
close=long stoploss=-YOUR_STOP_LOSS% type=market expect=1 error=closeside retries=10 id=SL #notify=discord:"`SL at   \z` {stop}" 
close=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 abort to just exit alert here) 
goto=main
 
:updateShort
# update your existing short TP/SL or similar here 
cancel id=SL,TP
close=short stoploss=+YOUR_STOP_LOSS% type=market expect=1 error=closeside retries=10 id=SL #notify=discord:"`SL at   \z` {stop}" 
close=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 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!