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

Cancel MIT Limit Pending Orders in a Strategy

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

    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.

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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Waxavi, Today, 02:10 AM
    1 response
    16 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by Kaledus, Today, 01:29 PM
    5 responses
    13 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by Waxavi, Today, 02:00 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Started by alifarahani, Today, 09:40 AM
    5 responses
    23 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by gentlebenthebear, Today, 01:30 AM
    3 responses
    17 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X