Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Scaling out using Advanced Order Handling

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

    Scaling out using Advanced Order Handling

    I understand it is best to have 2 separate entry orders if you want to have two exit targets. Therefore I assume you would have one IOrder reference variable for each target.
    My question: If I want both entries to have the same stop price, do I only need one stop IOrder reference variable that will deal with both entries? Or do I need a separate stop variable for each entry (like I do for the targets)?

    thanks.

    #2
    Two would be best.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Are stop and target object variables synchronized internally in any way?

      For example; for a 5 contract entry, if 3 contracts are filled at the target, and price reverses and 2 contracts are stopped out, will they both have reached a OrderState.Filled? Or will they both remain as OrderState.PartFilled forever?

      thanks.

      Comment


        #4
        Will not go Filled because that is the improper state. What will happen is that since there is no more position to close, the extra order gets cancelled. Remember as you get a part fill, the other gets amended to reflect the new remaining quantity.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          What are you referring to in the "other" ?

          Comment


            #6
            You have two orders. Whichever is the "other" order at the point in time is the one not being currently filled.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              So, after the "other"has been amended to reflect the new remaining quantity, would the stop.Quantity = stop.Filled, even though the stop.OrderState != OrderState.Filled?

              Comment


                #8
                In the above scenario, you mentioned that I will not reach the "Filled" state. What check should I use then, so that I can nullify my stop and target object variables?

                Comment


                  #9
                  astrolobe,

                  No need to overthink this. It is fairly simple.

                  Stop and target for 10 in place.

                  Stop fills for 5.
                  Target amends to 5.
                  Target fills 5. Target goes to state Filled.
                  Stop goes to state Cancelled.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Josh, this last little example helps a lot. This type of example should be in the documentation.
                    Just to be sure I have it right, could you please post the one line of code needed to set the stop and target variables to null? Based on your example, I think it should be something like this:
                    if (execution.Order.OrderState.Filled || execution.Order.OrderState.Cancelled)
                    {
                    stopOrder = null;
                    targetOrder = null;
                    }
                    Could you please confirm the above code, or changed it if it is wrong.
                    thanks.

                    Comment


                      #11
                      Astrolobe, there is a little more to it than that. Please review the sample titled using OnOrderUpdate() and OnExecution() methods to submit protective orders.
                      AustinNinjaTrader 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