I think it is quite easy to have a misunderstanding between a Trailing Target and a Trailing Stop(Losssss).
Of course we can use the Trailing Stop to lock in our profit (used as a Trailing Target), but I wonder whether Khaled meant that.
My understanding is that Training SL is triggered only when the position moves favorably. What if the position never goes into green? I need a stop loss as a security
But I must admit – I am not sure.
So maybe for my fun only :
PS: I actually wonder whether so many Trailing Stop codes pass the revue in PRC. Trailing Target, yes (much more easy).
What people additionally tell you is that line 93 in Live won’t work (I never tried it but believe them). It works in Backtest though (and even Live-Demo ?), so it is to be avoided (!). Net, both your Stop lines don’t work out.
This is not even correct as I use it all the time myself (crossed some wires once again). The one not working in Live (but works in BackTest and maybe only in PRT-IB) would be Set Stop Loss x Trailing y.
Now hopefully doing it right :
My understanding is that Training SL is triggered only when the position moves favorably. What if the position never goes into green? I need a stop loss as a security
The Set Stop pTrailing SLT perfectly works, also when you’re in a losing state. It trails under the price, which is possibly what you want after all, Khaled. Maybe off topic :
Trailing above the price is something else and what I personally would call “Trailing Loss”. It can be used when you’re in a profit state just the same. Normally it would be used to take position but this is not necessary at all. Careful again : this is what is possible manually in PRT-IB. I use that all the time too. In my opinion this is lacking in AutoTrading, or I just don’t know how to do it**. Thus example : trail above the price for a Long position and the trailing goes downwards. When you already have a position this works just the same as well. And now you can use it to invert …
This has its application when in a losing state as well, but the situation would be harder to grasp. It can lock in least-loss once you are sure to be losing, but wait for a retrace to make the best of it (and then invert on top of it).
**): Technically the command involved can be applied, but because it is at the wrong side of the price, it is accepted as a Market order and nothing trails. Not so with Manual trading (IB).
PS: What you, GraHal, linked to, is what I would call trailing (a) target. That this works with a Set Stop Trailing command is something else and confusing. In my personal view, @JC_Bywan has it right in this topic : Trailing Profit Target