Out of the many Trailing Stop Snippets on this website which do you …
- Most Prefer and have had best success with?
- Least prefer and have had least success with?
Say why if you want, but it’s not essential.
Please might you provide a link to the TS code or copy and paste the code on here?
Thank You
I like this trailing SL most.
Have tested many different trailing SL but this one usually works best, many others I get “tick mode” with high digits but rarely with this stop, so I like it best 🙂
//trailing stop function
trailingstart = 17// 20trailing will start @trailinstart points profit
trailingstep = 5// 5trailing step to move the "stoploss"
//reset the stoploss value
IF NOT ONMARKET THEN
newSL=0
ENDIF
//manage long positions
IF LONGONMARKET THEN
//first move (breakeven)
IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
newSL = tradeprice(1)+trailingstep*pipsize
ENDIF
//next moves
IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
newSL = newSL+trailingstep*pipsize
ENDIF
ENDIF
//manage short positions
IF SHORTONMARKET THEN
//first move (breakeven)
IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
newSL = tradeprice(1)-trailingstep*pipsize
ENDIF
//next moves
IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
newSL = newSL-trailingstep*pipsize
ENDIF
ENDIF
//stop order to exit the positions
IF newSL>0 THEN
SELL AT newSL STOP
EXITSHORT AT newSL STOP
ENDIF
set stop ploss 40