Trailing SL distance

Created at 09 Mar 2024, 12:15
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
PO

polepole

Joined 07.07.2023

Trailing SL distance
09 Mar 2024, 12:15


Hello,

I would appreciate some help with a trailing SL issue :) I have the following scenario:

  1. I open a BUY position at price P
  2. When the price reaches P+x pips, I set a SL at P+y pips (y < x)
  3. I activate the trailing SL for the position (position.ModifyTrailingStop(true);)

Queston 1: At what distance will the SL trail the current price?

Question 2: How do I modify/set the trailing distance?

Thank you,

Dinu


@polepole
Replies

firemyst
10 Mar 2024, 02:49

Question 1: the SL should trail at the distance it is the moment the ModifyTrailingStop is executed on the server. Note that because of rapid market movements this could change between when the bot executes the command to when the server actually receives and implements it. 

 

Question 2: you position.ModifyTrailingStop(false) and i) either way for the price to move to the distance you want, or ii) move the SL yourself to the desired distance. Then you can re-enable the trailing stop.

Or another way is while trailing stop is true, you move the trailing stop either forward/backward to the distance you want by doing position.ModifyStopLossPrice or position.ModifyStopLossPips

 


@firemyst

polepole
11 Mar 2024, 20:48 ( Updated at: 12 Mar 2024, 06:06 )

RE: Trailing SL distance

Thank you for your reply, it is almost clear now. Although it is strange that you do not have a parameter where you can specify the trailing distance when you activate the trailing SL.

Let me see if I understood corectly:

  1. I have a BUY opened at price P
  2. Price has risen at P+60pips and now I set a SL at P+15pips

Question 3: If I enable trialing SL, the SL will now trail at 45 pips below current price? Alternatively, if I enable trailing SL and there is no SL, it will trail at 60 pips?

Then:

  1. Price has now reached P+100 and SL is at P+55 (because it's trailing 45 pips)
  2. I move the SL to P+30pips

Question 4: Will this change the trailing distance to 70 pips?

Question 5: If I move the SL at P+70pips, will this change the trailing distance to 30 pips?
 

Thank you!

firemyst said: 

Question 1: the SL should trail at the distance it is the moment the ModifyTrailingStop is executed on the server. Note that because of rapid market movements this could change between when the bot executes the command to when the server actually receives and implements it. 

 

Question 2: you position.ModifyTrailingStop(false) and i) either way for the price to move to the distance you want, or ii) move the SL yourself to the desired distance. Then you can re-enable the trailing stop.

Or another way is while trailing stop is true, you move the trailing stop either forward/backward to the distance you want by doing position.ModifyStopLossPrice or position.ModifyStopLossPips

 

 


@polepole

firemyst
13 Mar 2024, 00:20

RE: RE: Trailing SL distance

polepole said: 

Thank you for your reply, it is almost clear now. Although it is strange that you do not have a parameter where you can specify the trailing distance when you activate the trailing SL.

Let me see if I understood corectly:

  1. I have a BUY opened at price P
  2. Price has risen at P+60pips and now I set a SL at P+15pips

Question 3: If I enable trialing SL, the SL will now trail at 45 pips below current price? Alternatively, if I enable trailing SL and there is no SL, it will trail at 60 pips?

Then:

  1. Price has now reached P+100 and SL is at P+55 (because it's trailing 45 pips)
  2. I move the SL to P+30pips

Question 4: Will this change the trailing distance to 70 pips?

Question 5: If I move the SL at P+70pips, will this change the trailing distance to 30 pips?
 

Thank you!

 

Some times the best way to learn is to try it yourself and see what happens… self discovery is a wonderful thing :-)

 3: If I enable trialing SL, the SL will now trail at 45 pips below current price? Alternatively, if I enable trailing SL and there is no SL, it will trail at 60 pips?

If you meant you set the SL at P+15 when price reached P+60, then yes, the SL should remain approximately 45 pips behind. I say “approximately” because cTrader doesn't move the SL with every tick (from what I understand) to keep server loads low.

 

Questions 4 & 5 - try it yourself manually. Place an order in a demo account. Wait for your order to get x-pips in profit. THen manually move your SL forward and/or backwards and watch what happens. Then you'll see it in action and learn so much more than by me answering your questions. 

 


@firemyst