Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cancel Pending Orders

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

    Cancel Pending Orders

    Using Strategy Builder (not NinjaScript), how can I cancel a pending limit order that was placed by the same strategy, if a certain condition is met. Important to this is that I'm not wanting to go flat on that instrument, in case there is already an open position there.

    #2
    Hello nathanc78,

    Thanks for your post.

    There is no means to cancel orders in the strategy builder.

    Limit orders in the Strategy builder will automatically be canceled at the end of the bar they are submitted on.

    "By default, orders submitted via Entry() and Exit() methods automatically cancel at the end of a bar if not re-submitted" Reference: https://ninjatrader.com/support/help...d_approach.htm


    Comment


      #3
      I can work with that. Thank you very much!

      Comment


        #4
        Actually, now that I think about it, the limit order might be pending for a few candles before it fills. So, I would need to lookback a few candles to see if the conditions were met but the order never filled. How would I do that in Strategy Builder?

        Comment


          #5
          Hello nathanc78,

          Thanks for your reply.

          Typically what one would do is when the conditions are met for placing an order, what you would do is to set a bool variable from false to true and save the limit entry price into a double variable. In another set you would check that the bool is true and that the market position is flat and then submit the limit order with the saved price. This will continue until the bar fills the limit order or you turn off the bool.

          You may need another set to determine in another condition when to turn off the bool.

          Comment


            #6
            Thank you! That makes sense...one follow up question: Let's say on the next set I'm evaluating the whether the boolean is true and whether the market position is flat. And let's say it's flat. But, it's only flat because the Profit Target was already hit?

            Another question: what if market position isn't flat but the position on is from a different strategy? If I evaluate for 'market position is flat', will that condition only evaluate positions from the current strategy? or all strategies on that instrument?

            Comment


              #7
              Hello nathanc78,

              Thanks for your reply.

              "Let's say on the next set I'm evaluating the whether the boolean is true and whether the market position is flat. And let's say it's flat. But, it's only flat because the Profit Target was already hit?" So this is a timing question. If a profit target is filled that would happen asynchronously to the strategy execution and takes time for the position object to be updated from Long/short to flat. The strategy execution depends on the "Calculate" setting. You would need to test your strategy on the sim101 account to understand if you will have any issues.

              "what if market position isn't flat but the position on is from a different strategy? If I evaluate for 'market position is flat', will that condition only evaluate positions from the current strategy? or all strategies on that instrument?" Each strategy runs independently and is not aware of any manual orders or orders from other strategies, so yes it only evaluates its orders/positions and not any others. We would advise to only run one strategy on an instrument to avoid the out of sync condition you would experience which would lead to unexpected orders.

              Comment


                #8
                Perfect! Thank you Paul!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Mindset, 04-21-2026, 06:46 AM
                0 responses
                88 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by M4ndoo, 04-20-2026, 05:21 PM
                0 responses
                134 views
                0 likes
                Last Post M4ndoo
                by M4ndoo
                 
                Started by M4ndoo, 04-19-2026, 05:54 PM
                0 responses
                68 views
                0 likes
                Last Post M4ndoo
                by M4ndoo
                 
                Started by cmoran13, 04-16-2026, 01:02 PM
                0 responses
                119 views
                0 likes
                Last Post cmoran13  
                Started by PaulMohn, 04-10-2026, 11:11 AM
                0 responses
                69 views
                0 likes
                Last Post PaulMohn  
                Working...
                X