Hi!
I´m trying to find a way to move SL, not depending on price but depending on time.
I have a scalping algo working on 10sec chart and when taking a trade I have a preset SL.
After that, If the price moves in the right direction, my break even code move the SL to lets say small profit of 1point.
Often the price movement stalls after that move and also quite often price goes back and hit the breakeven level.
So my idea is to move SL quite rapidly towards the price after breakeven code have done it´s work so at least a few more points are gained.
For example every minut (6bars at 10sec chart) the SL will be moved 1point against the price.
Any ideas how to do it?
Like this ? Not tested.
If not onmarket then
stopset = 0
endif
breakeven = positionprice
If longonmarket and highwashighenough and stopset = 0 then
sell at breakeven stop
nextstop = breakeven
stopset = 1
stopindex = barindex
endif
If stopset = 1 and barindex = stopindex + 6 then
nextstop = nextstop + 1
sell at nextstop stop
stopindex = barindex
endif
Thanks alot!
Took a while to get my head around it… I`m not a coder 😉
Row 7: “and highwashighenough” shouldn´t be there – right?
Row: 14-18 makes the loop?
Row 5: ok to change to “positionprice+1” ?
Of course row 7 should be there. It means that your special condition for setting the stop to break-even has been met.
Row 14-18 pull the stop 1 point higher every 60 seconds. And yes, setting the initial break even to any desired value in row 5 is ok.