Hi
I have read and tried too figure this out but I can’t get it too work. I would like too have a SL that moves with previous candle. If price moves up i want SL too move to be set too last candles low. I’m working long only..
There you go:
IF Not OnMarket THEN
NewSL = 0 //clear NewSL when not OnMarket
ELSE
IF close > close[1] THEN //update stop loss when price is rising
NewSL = max(NewSL,low[1]) //to previous candle's low, if higher than before
ENDIF
IF NewSL > 0 THEN
SELL AT NewSL STOP //exit at calculated stop, if any
ENDIF
ENDIF