• 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

CancelAllOrders

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

    CancelAllOrders

    If I have a unfilled stop order and a filled long position, to close everything should I use CancelAllOrders followed by ExitLong?

    and does CancelAllOrders raise an OnOrderUpdate event with order.OrderState == OrderState.Cancelled for each order cancelled?

    #2
    Hello delTik, and thank you for your question.

    If this is a NinjaTrader 7 question, the ATI method CancelAllOrders will not generate OnOrderUpdate events. You can safely use ExitLong() and ExitShort() whether you have open positions or not, with no arguments, to return to a flat position, provided you are not using signal names. ATI methods will all have to be checked on both sides of the ATI.

    If this is a NinjaTrader 8 question, we have prepared a short test, which shows CancelAllOrders() canceling several generated limit orders, and generating OnOrderUpdate events. We discovered putting this test together, however, that it is very easy to set an order to a pending cancel state, and to then modify it back with a price before it is successfully cancelled. Therefore, I would highly recommend, if you intend on relying on CancelAllOrders, that you include some position and state checking logic in your code similar to that in the sample I will provide.

    Please let us know if there is any other way we can help.
    Attached Files
    Jessica P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mike3238, Today, 07:09 PM
    0 responses
    1 view
    0 likes
    Last Post Mike3238  
    Started by sambo81, Today, 06:57 PM
    0 responses
    2 views
    0 likes
    Last Post sambo81
    by sambo81
     
    Started by erichuff, Today, 04:53 AM
    1 response
    26 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by stevenev1, Today, 01:43 PM
    0 responses
    8 views
    0 likes
    Last Post stevenev1  
    Started by shinuvu, Today, 11:05 AM
    3 responses
    18 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Working...
    X