Trailing Stop Loss TRIGGERED ONLY AFTER X pips gained (Advanced Protection)

Created at 08 Feb 2021, 21:04
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!
YO

your.success.starts.now

Joined 08.02.2021

Trailing Stop Loss TRIGGERED ONLY AFTER X pips gained (Advanced Protection)
08 Feb 2021, 21:04


I would kindly request that a feature that was already available on the platform over 7 years ago be re-included in a future update.

 

This video from the cTrader Youtube channel back in 2013 shows how cTrader used to have the Advanced Protection option to not only "Move Stop loss to break even" which is triggered after a certain amount of pips is gained (which is the only SL advanced protection option available now), but also had the option (already included in a past build) to trigger a trailing stop loss once a certain amount of pips was gained.

Right now, you can only include a trailing stop that then trails with each new pip in your direction).

But if you would want to ONLY have that trailing stop activated AFTER a certain amount of pips were gained (f.ex after the market has moved 20 pips in your direction, ONLY THEN does the trailing stop become activated which trails your positions by X pips).

 

PLEASE SHOW SUPPORT TO BRING THIS BACK!


cTrader
@your.success.starts.now
Replies

ismaeltrade
02 May 2023, 20:56

Re: Trailing Stop Loss TRIGGERED ONLY AFTER X pips gained (Advanced Protection)

This resource would be GREAT!


@ismaeltrade

ianmackers
21 Jan 2024, 21:13 ( Updated at: 22 Jan 2024, 06:38 )

RE: Re: Trailing Stop Loss TRIGGERED ONLY AFTER X pips gained (Advanced Protection)

ismaeltrade said: 

This resource would be GREAT!

See below where the stop loss is only triggered once the “Trailing Stop Trigger (pips)” is reached.

        [Parameter("Stop Loss (pips)", Group = "Risk Management", DefaultValue = 0.0, MinValue = 0.0, Step = 1)]
        public int StopLossPips { get; set; }
        
        [Parameter("Take Profit (pips)", Group = "Risk Management", DefaultValue = 0.0, MinValue = 0.0, Step = 1)]
        public double TakeProfitPips { get; set; }
        
        [Parameter("Trailing Stop Trigger (pips)", Group = "Risk Management", DefaultValue = 0.0, MinValue = 0, Step = 1)]
        public int TrailingStopTrigger { get; set; }

        [Parameter("Trailing Stop Step (pips)", Group = "Risk Management", DefaultValue = 0.0, MinValue = 0, Step = 1)]
        public int TrailingStopStep { get; set; }

        protected override void OnTick()
        {   
            // Update the trailing stops
            MaintainTrailingStops();
        }

        private void MaintainTrailingStops()
        {
            // Are trailing stops enabled?
            if (StopLossType == EnumStopLossType.TrailingStop)
            {
                var sellPositions = Positions.FindAll(cBotLabel, SymbolName, TradeType.Sell);
                foreach (var position in sellPositions)
                {
                    double distance = position.EntryPrice - Symbol.Ask;
                    if (distance < TrailingStopTrigger * Symbol.PipSize)
                        continue;
    
                    double newStopLossPrice = Symbol.Ask + TrailingStopStep * Symbol.PipSize;
                    if (position.StopLoss == null || newStopLossPrice < position.StopLoss)
                    {
                        position.ModifyStopLossPrice(newStopLossPrice);
                    }
                }
    
                var buyPositions = Positions.FindAll(cBotLabel, SymbolName, TradeType.Buy);
                foreach (var position in buyPositions)
                {
                    double distance = Symbol.Bid - position.EntryPrice;
                    if (distance < TrailingStopTrigger * Symbol.PipSize)
                        continue;
    
                    double newStopLossPrice = Symbol.Bid - TrailingStopStep * Symbol.PipSize;
                    if (position.StopLoss == null || newStopLossPrice > position.StopLoss)
                    {
                        position.ModifyStopLossPrice(newStopLossPrice);
                    }
                }
            }
        }


@ianmackers