Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Closing Strategy Positions/Working Orders Without Disabling Strategy

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

    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.

    #2
    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.​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    44 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    65 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X