• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 priceisking, Today, 12:51 PM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by chartish, Today, 10:33 AM
    3 responses
    19 views
    0 likes
    Last Post chartish  
    Started by casabella, Today, 11:51 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by Johnny, Today, 11:42 AM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_Jermaine  
    Started by habibalex, Today, 09:03 AM
    2 responses
    14 views
    0 likes
    Last Post sledge
    by sledge
     
    Working...
    X