• 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 RedDuke, Today, 06:14 PM
    0 responses
    4 views
    0 likes
    Last Post RedDuke
    by RedDuke
     
    Started by DariusDeck, Today, 04:22 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Marco  
    Started by pstrusi, Today, 05:05 PM
    1 response
    3 views
    0 likes
    Last Post pstrusi
    by pstrusi
     
    Started by saeed, Today, 10:20 AM
    4 responses
    20 views
    0 likes
    Last Post saeed
    by saeed
     
    Started by priceisking, Yesterday, 07:44 PM
    1 response
    27 views
    0 likes
    Last Post NinjaTrader_Kate  
    Working...
    X