Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

2 step trailing stop

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    2 step trailing stop

    Hallo.
    I would like to move the stop loss two times only.
    Can anybody help me? I'm not programmer and I have no idea how to do it

    First time once the price is greater than "n" ticks than entry price, set stop loss in the middle betwen stop loss price and breakeven.

    Second time once the price is greater then "m" ticks than entry price, set stop loss to break even price + "l" tick.

    My presend stop loss setting below.
    Thanks for help in advance.
    Rgds
    Czarek

    }
    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Resets the stop loss to the original value when all positions are closed
    if (Position.MarketPosition == MarketPosition.Flat)
    {
    SetStopLoss(CalculationMode.Ticks, stop);
    }

    // If a long position is open, allow for stop loss modification to breakeven
    else if (Position.MarketPosition == MarketPosition.Long)
    {
    // Once the price is greater than entry price+breakeven ticks, set stop loss to breakeven
    if (Close[0] > Position.AvgPrice + breakeven * TickSize)
    {
    SetStopLoss(CalculationMode.Price, Position.AvgPrice);
    }
    }

    // If a short position is open, allow for stop loss modification to breakeven
    else if (Position.MarketPosition == MarketPosition.Short)
    {
    // Once the price is lower than entry price-breakeven ticks, set stop loss to breakeven
    if (Close[0]+ breakeven * TickSize < Position.AvgPrice)
    {
    SetStopLoss(CalculationMode.Price, Position.AvgPrice);
    }

    #2
    Unfortunately you will need to have some programming skills to do this. Maybe someone will be kind enough to help out and program this for you otherwise, you could get in contact with a NinjaScript consultant as well.

    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    27 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    117 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    69 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    226 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    414 views
    0 likes
    Last Post CaptainJack  
    Working...
    X