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 cmoran13, Yesterday, 01:02 PM
    0 responses
    29 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    21 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    160 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    95 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    148 views
    2 likes
    Last Post CaptainJack  
    Working...
    X