and does CancelAllOrders raise an OnOrderUpdate event with order.OrderState == OrderState.Cancelled for each order cancelled?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
CancelAllOrders
Collapse
X
-
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?Tags: None
-
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 FilesJessica P.NinjaTrader Customer Service
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, Today, 06:46 AM
|
0 responses
11 views
0 likes
|
Last Post
by Mindset
Today, 06:46 AM
|
||
|
Started by M4ndoo, Yesterday, 05:21 PM
|
0 responses
17 views
0 likes
|
Last Post
by M4ndoo
Yesterday, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
15 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
82 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
48 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment