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 selu72, Today, 02:01 PM
|
1 response
7 views
0 likes
|
Last Post Today, 02:17 PM | ||
Started by WHICKED, Today, 02:02 PM
|
2 responses
12 views
0 likes
|
Last Post
by WHICKED
Today, 02:15 PM
|
||
Started by f.saeidi, Today, 12:14 PM
|
8 responses
21 views
0 likes
|
Last Post
by f.saeidi
Today, 01:55 PM
|
||
Started by Mikey_, 03-23-2024, 05:59 PM
|
3 responses
51 views
0 likes
|
Last Post
by Sam2515
Today, 01:47 PM
|
||
Started by Russ Moreland, Today, 12:54 PM
|
1 response
8 views
0 likes
|
Last Post Today, 01:01 PM |
Comment