Modify stop loss

Created at 16 Sep 2020, 10:25
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!
LU

luca.tocchi

Joined 25.03.2020

Modify stop loss
16 Sep 2020, 10:25


hi my bot should modify the stop loss (using ModifyOrder) when it reaches the stop loss minus 0.2 pips
how can I do?
 

thanks


@luca.tocchi
Replies

firemyst
17 Sep 2020, 07:48

RE:

luca.tocchi said:

hi my bot should modify the stop loss (using ModifyOrder) when it reaches the stop loss minus 0.2 pips
how can I do?
 

thanks

//for long positions

if ((Symbol.Bid - CurrentStopLossValue) / Symbol.PipSize <= 0.2)

{

    //price is within 0.2 pips of SL

   p.ModifiyStopLossPips //or p.ModifyStopLossPrice depending on what you want to do

}


@firemyst

luca.tocchi
18 Sep 2020, 16:40

RE: RE:

firemyst said:

luca.tocchi said:

hi my bot should modify the stop loss (using ModifyOrder) when it reaches the stop loss minus 0.2 pips
how can I do?
 

thanks

//for long positions

if ((Symbol.Bid - CurrentStopLossValue) / Symbol.PipSize <= 0.2)

{

    //price is within 0.2 pips of SL

   p.ModifiyStopLossPips //or p.ModifyStopLossPrice depending on what you want to do

}

Thanks a lot!


@luca.tocchi