Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What to do with an outstanding order

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

    What to do with an outstanding order

    Not sure how to handle the following the situation. ComputeOnBar = true.

    I get a setup Bar which tell me to go go short. In my code I issue an

    EnterShortStopLimit(DefaultQuantity, LimitPrice, StopPrice );

    New bars come in and my EnterShortStopLimit is NEVER filled.

    I now get a new setup Bar which tells me to go long. Am i required to issue a CancelOrder() before I issue the

    EnterLongStopLimit(DefaultQuantity, LimitPrice, StopPrice ); ?

    Or will NT automatically issue the Cancel. Will the auto cancel and new EnterLongStopLimit() both be submitted to execute in sequence on the current bar? Or will they be spread out over the current bar (for the cancel) and the LongStopLimit() on the next bar?

    #2
    NT will automatically cancel your original order if you do not resubmit it to keep it alive. If it is not kept alive you can go ahead and submit your new order.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      NT will automatically cancel your original order if you do not resubmit it to keep it alive. If it is not kept alive you can go ahead and submit your new order.
      I will have to monitor this in real-time. Is the order canceled first, internally in NT before my OnBarUpdate() is called. Or is the order canceled after I have exited the OnBarUpdate().

      Comment


        #4
        It will have to be at the end because you can submit a keep alive order anytime within the OnBarUpdate(). It may be best for you just to work directly with IOrder objects and actively submit CancelOrder(). Then just wait for the IOrder's status change to Cancelled and then you will be in the green to submit your other orders.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          This is how NT handles canceling working StopLimit orders in real time with ComputeOnBar close = true.

          At the close of the 12:51:48 bar I have an EntryLongStopLimit that is active. My indicator tells me to switch from looking to go long to looking to go short. I know issue a EntryShortStopLimit and exit the OnBarUpdate. In the Orders window the Buy StopLimit order is cancled at 12:51:50. However, no SellShort StopLimit order appears in the Orders window.

          Now the 12:55:20 bar closes and still no ShellShort order in the Orders window. Since I still looking to go short, I again issue the very same EntryShortStopLimit and proceed to exit the OnBarUpdate. At 12:55:22 the SellShort StopLimit order appears in the Orders window.

          So, my conclusion is that NT can only process 1 order type per bar regardless of whether the order type is generated internally in NT or by the user in the OnBarUpdate. All additional order types are after the 1st one is ignored by NT.

          Comment


            #6
            Hi scjohn,

            I recommend you use TraceOrders = true to test this. I believe you will find that if you are waiting for the original long order to auto cancel that does not happen till after the OnBarUpdate(). What this means is that you will not be able to submit your short order because on that bar you still have a long order. That is why your order is not accepted till the next bar for your short.

            The quickest way to switch sides is to manually cancel the original long order and then use the OnOrderUpdate() method. The moment you receive the Cancelled state for the long order you submit your short order. This may or may not be received and processed before the end of the 12:51:48 bar, but it represents the fastest possible time in getting out your new order.
            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
            624 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            359 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
            562 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            567 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X