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 JonesJoker, 04-22-2024, 12:23 PM
|
6 responses
32 views
0 likes
|
Last Post
by JonesJoker
Today, 05:14 AM
|
||
Started by GussJ, 03-04-2020, 03:11 PM
|
12 responses
3,239 views
0 likes
|
Last Post
by Leafcutter
Today, 05:08 AM
|
||
Hi
by AveryFlynn
Started by AveryFlynn, Today, 04:57 AM
|
0 responses
5 views
0 likes
|
Last Post
by AveryFlynn
Today, 04:57 AM
|
||
Started by RubenCazorla, 08-30-2022, 06:36 AM
|
3 responses
79 views
0 likes
|
Last Post
by PaulMohn
Today, 04:44 AM
|
||
Started by f.saeidi, Yesterday, 12:14 PM
|
9 responses
25 views
0 likes
|
Last Post
by f.saeidi
Today, 04:39 AM
|
Comment