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 MIT Limit Pending Orders in a Strategy
Collapse
X
-
Cancel MIT Limit Pending Orders in a Strategy
Hi, in my strategy I place MIT Limit Pending Orders that may not get filled and may remain active after my strategy close a position at profit or stop loss target; there is gotta be a way to cancel/close those pending orders without going through advanced order management and monitoring past orders, which is becoming a headache for me coding it now. How can I cancel all pending orders once my Position.Quantity is back to 0 (any positions closed) and before executing the next new trade cycle? I really need help here.... Thanks.Tags: None
-
Hello shahabjet1,
Thank you for your post.
There's not really a good option for you here. To cancel pending orders you would need to track with Order objects and use CancelOrder(), or let them cancel on their own with IsLiveUntilCancelled set to false for the order, in which case they would be automatically cancelled once the conditions that triggered the order submittal are no longer true. There would not be a way to cancel all pending orders for the strategy otherwise without using Account.Flatten(), which would flatten all positions and cancel all pending orders on the account for the instrument in question and also disable the strategy.
Please let us know if we may be of further assistance to you.Kate W.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Stanfillirenfro, Today, 07:23 AM
|
1 response
2 views
0 likes
|
Last Post Today, 07:37 AM | ||
Started by cmtjoancolmenero, Yesterday, 03:58 PM
|
2 responses
20 views
0 likes
|
Last Post Today, 07:24 AM | ||
Started by olisav57, Yesterday, 07:39 PM
|
1 response
9 views
0 likes
|
Last Post Today, 07:23 AM | ||
Started by cocoescala, 10-12-2018, 11:02 PM
|
7 responses
943 views
0 likes
|
Last Post
by Jquiroz1975
Today, 07:21 AM
|
||
Started by oviejo, Today, 12:28 AM
|
1 response
12 views
0 likes
|
Last Post Today, 07:20 AM |
Comment