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 traderqz, Today, 12:06 AM
    3 responses
    4 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by RideMe, 04-07-2024, 04:54 PM
    5 responses
    28 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by f.saeidi, Today, 08:13 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by DavidHP, Today, 07:56 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by kujista, Today, 06:23 AM
    3 responses
    11 views
    0 likes
    Last Post kujista
    by kujista
     
    Working...
    X