Can you please tell me how to cancel all open orders by strategy, (I have several strategy started at the same time).
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Cancel All Orders by strategy
Collapse
X
-
Hello soma8,
Thank you for writing in.
Just to clarify, are you attempting to cancel all open orders made from the specific strategy itself, or are you trying to cancel orders across all strategies submitted to your account from just one strategy?
To do the former, you can use the undocumented method, CancelAllOrders(). This method requires two arguments passed to it:
Code:CancelAllOrders(bool entries, bool exits);
If you would like to cancel orders across your account, I would suggest taking a look at this very helpful post from one of my colleagues, Jesse, that details how you can loop through the orders placed on the account to cancel them: http://ninjatrader.com/support/forum...78&postcount=2
Please, let us know if we may be of further assistance.Zachary G.NinjaTrader Customer Service
-
Thank you,
protected override void OnExecutionUpdate(Cbi.Execution execution, string executionId, double price, int quantity,
Cbi.MarketPosition marketPosition, string orderId, DateTime time)
{
//traitements
CancelAllOrders(true, true);
}
Comment
-
Hello soma8,
I apologize for the misunderstanding; as this question was not posted in the NinjaTrader 8 section and it was not specified that this was for NinjaTrader 8, I have provided syntax for NinjaTrader 7.
You would need to loop through the Orders collection and cancel each order.
Example:
Code:foreach (Order o in Orders) { CancelOrder(o); }
Zachary G.NinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by CortexZenUSA, Today, 12:46 AM
|
0 responses
0 views
0 likes
|
Last Post
by CortexZenUSA
Today, 12:46 AM
|
||
Started by usazencortex, Today, 12:43 AM
|
0 responses
2 views
0 likes
|
Last Post
by usazencortex
Today, 12:43 AM
|
||
Started by sidlercom80, 10-28-2023, 08:49 AM
|
168 responses
2,262 views
0 likes
|
Last Post
by sidlercom80
Today, 12:05 AM
|
||
Started by Barry Milan, Yesterday, 10:35 PM
|
3 responses
10 views
0 likes
|
Last Post Yesterday, 11:58 PM | ||
Started by WeyldFalcon, 12-10-2020, 06:48 PM
|
14 responses
1,429 views
0 likes
|
Last Post
by Handclap0241
Yesterday, 10:43 PM
|
Comment