Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unmanaged Orders -Setting order to null verses canceling it

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

    Unmanaged Orders -Setting order to null verses canceling it

    What is the difference between setting an order=null verses using the Cancel Method?

    #2
    Hello Cowpux,

    Setting the variable to null, causes the variable to no longer hold the IOrder object. This does not cancel the order, or cause the IOrder object that was once held to be changed at all, it simply removes the IOrder object from the variable and replaces this with a null value.

    Calling CancelOrder() causes NinjaTrader to send a cancellation request to the brokerage so that the order is cancelled on their end. When calling this, it does not remove the IOrder object from the variable. This means the order will still be attached to the variable but the IOrder will have the OrderState equal to OrderState.Cancelled.

    Setting the variable to null after an order is cancelled or rejected allows for you to detect this in the script when placing a new order. This is more of a coding style than required though.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X