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
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.Gaby V.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Graci117, Today, 09:02 PM
|
1 response
10 views
0 likes
|
Last Post Today, 09:09 PM | ||
Started by ETFVoyageur, Today, 07:55 PM
|
0 responses
8 views
0 likes
|
Last Post
by ETFVoyageur
Today, 07:55 PM
|
||
Started by janio973, Today, 07:24 PM
|
1 response
7 views
0 likes
|
Last Post Today, 07:35 PM | ||
Started by aligator, 01-06-2022, 12:14 PM
|
4 responses
248 views
0 likes
|
Last Post
by john_44573
Today, 06:11 PM
|
||
Started by reynoldsn, Today, 05:56 PM
|
0 responses
15 views
0 likes
|
Last Post
by reynoldsn
Today, 05:56 PM
|
Comment