Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OrderState.PendingCancel

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

    OrderState.PendingCancel

    When cancelling an order, exactly when does OrderState update to OrderState.PendingCancel? Immediately after sending CancelOrder, or does NT first need to receive some sort of acknowledgement from the broker or from the exchange?

    Second, if everything proceeds well, is it possible for the order to reach OrderState.Cancelled without first reaching OrderState.PendingCancel?

    Third, can one expect different behaviour on live and Sim accounts? Asking this because the code below may sometimes print "Cancelling buy" dozens of times before the order gets cancelled on Sim. Haven't noticed this when trading live.

    if (buyOrder != null)
    {
    if (buyOrder.OrderState != OrderState.PendingCancel)
    {
    Print(
    "Cancelling buy");
    CancelOrder(buyOrder);
    }
    return;
    }

    #2
    Hi,

    1) An order is set to state PendingCancel as soon as you cancel the order within NinjaTrader and before the cancel request is sent to the broker/exchange.

    2) An order will always follow the sequence PendingCancel, Cancelled if everything proceeds well.

    3) I believe the behaviour should be the same. I would change your code to print out the order state to see when your code executes. PendingCancel state in theory should only be set once for the lifetime of an order.
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    648 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X