Profit trailing
-
Hello,
I want to set TP and SL manually and I would like that the algorithm will trail my profit and will do following:
if price has reached 25% of TP level, move SL to 12% of TP level
if price has reached 50% of TP level, move SL to 25% of TP level
if price has reached 75% of TP level, move SL to 50% of TP levelfor example: I set manually TP level to 100pip. And if price reaches to 25 pip from the open price, then SL is moved to 12pip level. If the price reaches to 50 pip from the open price, then it moves SL to 25 pip. If price reaches 75 pip from the open price it moves SL to the 50 pip level.
Could anyone help me to implement that logic?
-
Try the trailing stop, it has all kinds of options, like trail by a % of profit or a % of TP
-
@roar Thank You for the quick response!
Unfortunately I did not find that option in trailing stop block.

I tried to do the following:
Check distance between open price and TP and if it is 75% then modify SL to 50% etc. But it did not work.

-
@mmaarits
You have to use some kind of "trailing start", a treshold before applying the "% of profit" trailing, because 50% of 0 is 0, so it will not work at the open price.

This trails 50% of profit, it does not have just 2 steps like in your example, it continuously adjusts the distance.
@mmaarits said in Profit trailing:
if price has reached 75% of TP level, move SL to 50% of TP level
Why the 3rd step is not half of profit anymore? Do you need some exponential function, like the trailing stop gets thinner the closer the TP is?
-
@roar Thank You again for the very quick reply!
And I want also to thank You for the solution! It's great and helps me too!
My idea is to protect profit and my initial idea was to do it with 3 steps. Those levels seemed valid.
Profit levels description:
12,5% level - to avoid loss
25% level - minimum profit
50% level - good profit
TP level - excellent profit -
I tried to use "check distance" block, but it doesn't work also.

-
This might be work (not tested)


https://fxdreema.com/shared/ehY5VNLF
The project´s logic shoud be:
TrailingStopStep == 12.5
ProfitStep == 25
TrailStopEnabled == falseIf no position exists -> Modify (TrailStopEnabled == true) && Reset values && Reset Counter
If position exists && TrailStopEnabled == true -> For each position -> If profit >= TP*(ProfitStep/100) --> Modify SL Level to (TrailingStopStep %) of current TP && Modify (TrailingStopStep *2, ProfitStep +25) && Counter == 1
That will be executed again for the new values of TrailingStopStep & ProfitStep.
When the Counter == 2, next time (3) the block passes && TrailStopEnabled == false disabling the TrailingStop and no other TS move is expected.
Hope this helps.
-
@josecortesllobat WOW! Thank You very much!!! I will test it tomorrow when the market is open.