Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

scale-out and update Stop Loss

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

    scale-out and update Stop Loss

    Hi, I know this has been posted many times, but I'm struggling to get this right.

    I'm opening a position of 3 contracts. I'm sending 3 orders because I want to scale out. All 3 contracts have the same Stop Loss with 3 different targets:

    if (LONG_CONDITION) {
    SetStopLoss("Long1", CalculationMode.Ticks , stop1Ticks, false);
    SetProfitTarget("Long1", CalculationMode.Ticks, target1Ticks);

    SetStopLoss("Long2", CalculationMode.Ticks, stop1Ticks, false);
    SetProfitTarget("Long2", CalculationMode.Ticks, target2Ticks);

    SetStopLoss("Long3", CalculationMode.Ticks, stop1Ticks, false);
    SetProfitTarget("Long3", CalculationMode.Ticks, target3Ticks);

    entryOrder = EnterLong(DefaultQuantity, "Long1");
    entryOrder = EnterLong(DefaultQuantity, "Long2");
    entryOrder = EnterLong(DefaultQuantity, "Long3");
    }

    Now, I'm struggling to update the stops when the first target is hit.
    When the first target is hit, I want to move the stops for Long2 and Long3 to Breakeven.

    Can anybody give me a quick code for the OnExecution function to do that?
    How do I identify which order was filled??

    Thanks for any help!

    #2
    Hi jbrooks727 - welcome to the NinjaTrader support forums! Please review this reference sample here - http://www.ninjatrader-support2.com/...ead.php?t=7499

    Comment


      #3
      Thanks, I was looking at different examples, I'll give it a try once again.

      So, basically I need to have different identifiers for each order, right? (and I can match the 'tokens' to identify each particular order)
      And I need to handle the OCO bracket manually, right? when the stop or the target is hit, then I need to cancel the other side manually...it'll not get done automatically??

      Thanks again for the quick reply!

      Comment


        #4
        That is all correct. You want to cancel remaining OCO orders.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X