Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Closing Strategy Positions/Working Orders Without Disabling Strategy
Collapse
X
-
Closing Strategy Positions/Working Orders Without Disabling Strategy
I have a strategy that enters orders and places take profit and stop loss. I'm trying to create a custom "Close" button that closes the position and working orders without disabling the strategy. I'm good with creating the button but haven't figured out the logic behind closing open positions and cancelling working orders without disabling the strategy. Any guidance would be appreciated.Tags: None
-
Hello jclose,
Thank you for your post.
<Account>.CancelAllOrders() could be used to cancel all orders on an instrument. This method can be used in a NinjaScript strategy.
See this help guide page for more information about accessing the Account class and sample code: https://ninjatrader.com/support/help...ount_class.htm
See this help guide page about <Account>.CancelAllOrders() and sample code: https://ninjatrader.com/support/help...lallorders.htm
Another way to cancel all orders from the strategy is you can loop through the orders in the account and cancel them with CancelOrder().
See this forum thread for more information about looping through orders on the account and canceling them with CancelOrder(): https://ninjatrader.com/support/foru...17#post1130617
Please let me know if I may further assist.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
87 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
132 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
65 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
118 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
67 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment