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 argusthome, 03-08-2026, 10:06 AM
    0 responses
    93 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    48 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    31 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    34 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    70 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X