Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How ro verify an order is cancelled?

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

    How ro verify an order is cancelled?

    Hi NT experts,

    I would like to verify the cancellation of an order but pendingcancell is the most i can get.

    I've noticed that when i cancell an order, the order.OrderState will show pendingcancell as the last state. After it is fully cancelled, the order is automatically set to null. Any further inquiry into the status will yield error message as "Objetc reference not set to an instance of the object".

    Is there a way to get the status of OrderSate.Cancelled?

    any suggestions are welcome.

    #2
    binwang2,

    This suggests to me that your code is explicitly setting it to null by itself. The IOrder will never be set to null. Once it is null you can't access its old properties because it has been "erased".

    Find where you are resetting to null and don't do that step if you want to preserve old states.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      You are right. It is explitly set to null in OnOrderUpdate once an order is cancelled.

      Commented out that step and got Order.cancelled status.

      Thanks.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      152 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      89 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      131 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      127 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      107 views
      0 likes
      Last Post CarlTrading  
      Working...
      X