Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cancel All Orders by strategy

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

    Cancel All Orders by strategy

    Hello,
    Can you please tell me how to cancel all open orders by strategy, (I have several strategy started at the same time).

    #2
    Hello soma8,

    Thank you for writing in.

    Just to clarify, are you attempting to cancel all open orders made from the specific strategy itself, or are you trying to cancel orders across all strategies submitted to your account from just one strategy?

    To do the former, you can use the undocumented method, CancelAllOrders(). This method requires two arguments passed to it:
    Code:
    CancelAllOrders(bool entries, bool exits);
    Setting the first bool to true will cancel all open entry orders and setting the second bool to true will cancel all open exit orders.

    If you would like to cancel orders across your account, I would suggest taking a look at this very helpful post from one of my colleagues, Jesse, that details how you can loop through the orders placed on the account to cancel them: http://ninjatrader.com/support/forum...78&postcount=2

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Thank you,

      I want to cancel all open orders made from the specific strategy itself.

      Comment


        #4
        Hello soma8,

        Thank you for the clarification.

        You would want to utilize the CancelAllOrders() method mentioned in my previous post.

        Please, let us know if we may be of further assistance.
        Zachary G.NinjaTrader Customer Service

        Comment


          #5
          Thank you,
          protected override void OnExecutionUpdate(Cbi.Execution execution, string executionId, double price, int quantity,
          Cbi.MarketPosition marketPosition, string orderId, DateTime time)
          {
          //traitements
          CancelAllOrders(true, true);
          }
          but i have an error in script: the name 'CancelAllOrders' does not exist in the current context.

          Comment


            #6
            Hello soma8,

            I apologize for the misunderstanding; as this question was not posted in the NinjaTrader 8 section and it was not specified that this was for NinjaTrader 8, I have provided syntax for NinjaTrader 7.

            You would need to loop through the Orders collection and cancel each order.

            Example:
            Code:
            foreach (Order o in Orders)
            {
                 CancelOrder(o);
            }
            Please, let us know if we may be of further assistance.
            Zachary G.NinjaTrader Customer Service

            Comment


              #7
              Thank you, now il's working

              Comment


                #8
                Originally posted by soma8 View Post
                I want to cancel all open orders made from the specific strategy itself.
                Sorry, I am confused.

                Do you mean one specific instance of strategy XYZ?

                Or all instances of the one specific strategy known as XYZ?

                I think this is an important distinction.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                607 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                353 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                105 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                560 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                561 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X