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!
See more
See less

Partner 728x90

Collapse

Closing Strategy Positions/Working Orders Without Disabling Strategy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NinjaTrader_Gaby
    replied
    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.​

    Leave a comment:


  • 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.

Latest Posts

Collapse

Topics Statistics Last Post
Started by ccrone2024, Today, 05:13 AM
0 responses
3 views
0 likes
Last Post ccrone2024  
Started by ttodua, Today, 03:40 AM
0 responses
5 views
0 likes
Last Post ttodua
by ttodua
 
Started by ttodua, Today, 03:18 AM
0 responses
5 views
0 likes
Last Post ttodua
by ttodua
 
Started by TraderKnG, Today, 01:30 AM
0 responses
11 views
0 likes
Last Post TraderKnG  
Started by morrnel, 05-12-2024, 06:07 PM
8 responses
156 views
1 like
Last Post nobchi
by nobchi
 
Working...
X