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


    Paul H.NinjaTrader Customer Service

    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.
          Paul H.NinjaTrader Customer Service

          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.
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                Perfect! Thank you Paul!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by MacDad, 02-25-2024, 11:48 PM
                7 responses
                158 views
                0 likes
                Last Post loganjarosz123  
                Started by Belfortbucks, Today, 09:29 PM
                0 responses
                7 views
                0 likes
                Last Post Belfortbucks  
                Started by zstheorist, Today, 07:52 PM
                0 responses
                7 views
                0 likes
                Last Post zstheorist  
                Started by pmachiraju, 11-01-2023, 04:46 AM
                8 responses
                151 views
                0 likes
                Last Post rehmans
                by rehmans
                 
                Started by mattbsea, Today, 05:44 PM
                0 responses
                6 views
                0 likes
                Last Post mattbsea  
                Working...
                X