Hello,
I have this problem with my ‘algo’ and it is driving me crazy. I see in Demo and in real that very often the trailing stop goes backwards, and it is not supposed to do that. Once a new profit has been achieved it must stay at that position. My TS is defined as a moving trailing stop, just hidden behind the EMA(9) and moving along the price, in long and short trades.
It moves back even after a candle has closed, discarded because the average price position in the current candle changes.
To simplify the code:
If TS
ts1 = CLOSE – EMA9[0]
SET STOP TRAILING ts1
endif
Is there any axplanation for this behavior?? I can change instead for a dynamic stop loss, but the trailing is the right tool for this purpose.
Thanks in advance
———————
my original code equivalent is this:
if TS
trailmargin = EMA9[0]*ts1MMA1/100
ts1 = CLOSE – (MMA1[0]- trailmargin)
SET STOP TRAILING TS1
endif