~~Title: Adjust Position Stops~~
{{tag>guides}}
==== Example to adjust Stops on an Open Position====
It is always recommended to use testnet/sandbox first!
#~~codedoc:clean: 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
#~~codedoc:clean: 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 ~~codedoc:clean:#notify=discord:"`SL at \z` {stop}"~~
close=long takeprofit=+0.5% price=+YOUR_TAKE_PROFIT% expect=1 error=closeside retries=10 id=TP ~~codedoc:clean:#notify=discord:"`TP at \z` {price}"~~
#~~codedoc:clean: we continue with main order (alternatively use abort to just exit alert here)~~
goto=main
:updateShort
#~~codedoc:clean: 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 ~~codedoc:clean:#notify=discord:"`SL at \z` {stop}"~~
close=short takeprofit=-0.5% price=-YOUR_TAKE_PROFIT% expect=1 error=closeside retries=10 id=TP ~~codedoc:clean:#notify=discord:"`TP at \z` {price}"~~
#~~codedoc:clean: we continue with main order (alternatively use abort to just exit alert here)~~
goto=main
:main
#~~codedoc:clean: 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!