Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnExecution() order fill condition

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

    OnExecution() order fill condition

    I noticed the following code in one of NinjaTrader's strategy examples (SampleOnOrderUpdate.cs) when testing to see if an order has been filled in OnExecution(). One of the tests were:

    Code:
    if ( (execution.Order.OrderState == OrderState.Cancelled) && (execution.Order.Filled > 0) )
    // process new order fill...
    Under what circumstances could this condition happen where the order state is cancelled and yet the order also received a fill?
    Last edited by risingfire; 06-25-2014, 12:40 PM.

    #2
    Hello risingfire,

    It is possible to cancel an order that has partial filled but not completely filled.

    When this happens you may want to detect this, and then use the filled amount to manage your position, such as exiting that quantity or creating a stop for that quantity.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you, Chelsea, that is helpful. In these situations, who is doing the cancelling?

      For example, would I see this condition if I submit a CancelOrder() but the order was partially filled?

      Is there any situation when the brokerage would cancel the order with only a partial fill?

      Comment


        #4
        Hi risingfire,

        This would be if you cancel the order yourself using CancelOrder().

        Im not really sure of a situation where a broker would cancel any order, I would recommend that you contact your broker and ask about this.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thank you; much appreciated.

          Comment


            #6
            Originally posted by risingfire View Post
            Thank you, Chelsea, that is helpful. In these situations, who is doing the cancelling?

            For example, would I see this condition if I submit a CancelOrder() but the order was partially filled?

            Is there any situation when the brokerage would cancel the order with only a partial fill?
            Not quite the brokerage; more like the NT processing engine.

            Say you have a large limit order. The market takes off after a partial fill and never returns, so the order cannot be completed. NT will cancel the unfilled order when the next bar opens. Ergo, you have a partial order that gets cancelled.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            117 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            165 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            85 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            130 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            88 views
            0 likes
            Last Post PaulMohn  
            Working...
            X