Stop Loss following the higher low

Created at 11 Sep 2023, 08:18
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!
AL

alexandre.bussy

Joined 08.09.2023

Stop Loss following the higher low
11 Sep 2023, 08:18


Hello,

I want to code something like that :

If CandleLow is > EntryPrice then Stop Loss 1pip below the Low.

And then Move the Stop Loss  below each Low of new candle.

 

Thanks


@alexandre.bussy
Replies

firemyst
11 Sep 2023, 18:27

//For longs
if (Bars.LowPrices.Last(0) > yourPosition.EntryPrice)
{
    int newStopLoss = Bars.LowPrices.Last(0);
    TradeResult r = yourPosition.ModifyStopLossPrice(newStopLoss);
    if (r.IsSuccessful)
      ...
    else
        ...
}

@firemyst