Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Price can't be changed below the market question

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

    Stop Price can't be changed below the market question

    So im paper trading at the moment and I'm getting this error.
    Click image for larger version

Name:	image.png
Views:	895
Size:	17.7 KB
ID:	1227623

    1. My first question is could you explain why this is happening? After reading some old posts, I get the jist but not the full picture clearly.

    2. Looking at this older post, and to explain how my strategy works is that I set stop losses whenever the current swing high or swing low is higher or lower than the previous swing high/low. Is what Jesse said in the old post that I cant use old Highs and Lows to set stop losses? If so what can I do to workaround it since my strategy relies on using previous highs and lows to set stop losses.
    Click image for larger version

Name:	image.png
Views:	772
Size:	47.4 KB
ID:	1227624
    https://ninjatrader.com/support/forum/forum/ninjatrader-8/strategy-development/1164616-buy-to-cover-stop-market-order-below-current-price ​


    Thanks!

    #2
    Click image for larger version

Name:	image.png
Views:	763
Size:	18.9 KB
ID:	1227626
    More examples​

    Comment


      #3
      tchen7 You may already know this, but just in case, there are some unbreakable rules regarding submitting Orders at specific prices vs current market Ask and Bid prices:
      • Order types that MUST be GREATER than the current ASK price: Sell Limit, Sell MIT, Buy StopMarket
      • Order types that MUST be LESS than the current BID price: Buy Limit, Buy MIT, Sell StopMarket
      No matter how an Order is submitted, it must satisfy these rules. This includes any price changes to existing Orders of these types.

      Hope that is useful.

      Thanks.
      Multi-Dimensional Managed Trading
      jeronymite
      NinjaTrader Ecosystem Vendor - Mizpah Software

      Comment


        #4
        Hello tchen7,

        Thanks for your note.

        This error message means that the strategy attempted to change an order to the wrong side of the market. If this is due to market volatility then there isn't really a way to 100% avoid this occurring, as in volatile markets the market could move so far and fast that this would occur.

        jeronymite is correct. Buy stop market orders must be placed above the current Ask price. Sell stop market orders must be placed below the current Bid price.

        As stated by my colleague Jesse in the forum post you shared, you must make sure that the price you are submitting or changing the order to is a valid price and on the correct side of the market. This could be done by checking if the current market price (Close[0]) is greater than or less than the price you are submitting the order to.

        You could also consider using RealtimeErrorHandling.IgnoreAllErrors to trap order errors in OnOrderUpdate by checking error == ErrorCode.UnableToChangeOrder.

        Please note that setting this property value to IgnoreAllErrors can have serious adverse affects on a running strategy unless you have programmed your own order rejection handling in the OnOrderUpdate() method. To do this you could trap the rejected order by checking if the OrderState is Rejected within OnOrderUpdate() followed by defining your own order rejection handling behavior for the rejected order.

        Please see the example in the help guide link below that demonstrates using RealtimeErrorHandling and trapping a rejected order in OnOrderUpdate().

        RealtimeErrorHandling — https://ninjatrader.com/es/support/h...orhandling.htm

        Let me know if I may assist further.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Hello NinjaTrader_BrandonH ,

          Just to clarify, you can set Error Handling to RealtimeErrorHandling.StopCancelCloseIgnoreRejects . That will close the strategy on all other errors than rejected orders, correct? So, you retain most of the safety of the built in error handling. You just have handle rejected orders.

          Given that (assuming that's correct), is the error, ErrorCode.UnableToChangeOrder, considered an order rejection?

          Thanks,
          Matt

          PS: Thank you, jeronymite, for the succinct summary of order submission when near/at current price.

          Comment


            #6
            Hello StealthM93,

            Thanks for your note.

            Yes, RealtimeErrorHandling.StopCancelCloseIgnoreRejects will stop the strategy, cancel any remaining working orders, and then close any open positions managed by the strategy unless the error is an order rejection error. If the error is an order rejection, the strategy will resume running.

            That is correct. If you run the strategy with RealtimeErrorHandling.StopCancelCloseIgnoreRejects and you get the UnableToChangeOrder error message, the strategy will continue running.

            Please let me know if I may assist further.
            <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

            Comment


              #7
              Thank you for confirming, BrandonH!

              Comment


                #8
                I'm encountering this exact error sometiems in playback, when attempting to change the stop loss price to a price that is well above current market price. For example, my strategy is trying to set stop loss price to 20280 when market price is 20266, and it keeps popping up an infinite number of these Error popups saying "Stop price can't be changed below the market. affected Order: BuyToCover 5 StopMarket @ 20280.00"

                Comment


                  #9
                  Are you using ATMs in your strategy? So there is no conflict, you should not have ChartATM active and if you do have it visible, make sure that the "ATM Strategy" is not set,,otherwise that will cause conflicts with your Scripted Strategy. If you are using ATM Strategies within your script specifically, then that's another story.

                  Issues related to bad Stop pricing for ATMs are recently being discussed in https://forum.ninjatrader.com/forum/...g-atm-strategy

                  This post also helps with the annoying Error dialogs, fwiw... https://forum.ninjatrader.com/forum/...35#post1319635

                  Comment


                    #10
                    Originally posted by b.j.d View Post
                    Are you using ATMs in your strategy? So there is no conflict, you should not have ChartATM active and if you do have it visible, make sure that the "ATM Strategy" is not set,,otherwise that will cause conflicts with your Scripted Strategy. If you are using ATM Strategies within your script specifically, then that's another story.

                    Issues related to bad Stop pricing for ATMs are recently being discussed in https://forum.ninjatrader.com/forum/...g-atm-strategy

                    This post also helps with the annoying Error dialogs, fwiw... https://forum.ninjatrader.com/forum/...35#post1319635
                    Thanks for the heads up. Very strange potential bug discussed in first thread.
                    I don't use ATM in my strategy as it's fully custom managed by the strat. But I do typically have an ATM and different account selected in Chart Trader... Who knows if it could be somehow affecting it due to a bug.

                    Thanks for the other thread too sharing the auto-close error dialog script.

                    Comment


                      #11
                      This issue just cost me over 20 points because I couldn't close my trade because NT popped up over 380 of these "can't change stop price above market" error windows.
                      NT seriously, if someone has a flaw in their strategy code somewhere which causes this erorr, why would you not allows us to disable these popups? If a strategy messes up during a live trade, why would you purposely take away our abiity to manually intervene by forcing us to have these error popup windows which can't be closed fast enough and prevent us from clicking anywhere else. I couldn't close my trade or anything.

                      This is very frustrating. Is there a vote open for this?

                      Comment


                        #12
                        iantriestrading Sorry to hear that; but I've been there too. I have seen these Error Dialog storms numerous times. It is frustrating that NT has not taken an interest to fix this problem in 20 years.

                        fwiw, to be defensive, it has forced me to always have the Mobile or web app logged in simultaneously, to be able to close positions. Though managing that with say multiple prop accounts can be a nightmare as well. The Web with grouped accounts is about the best I've found (Close button added to Positions View).

                        Comment


                          #13
                          Originally posted by b.j.d View Post
                          iantriestrading Sorry to hear that; but I've been there too. I have seen these Error Dialog storms numerous times. It is frustrating that NT has not taken an interest to fix this problem in 20 years.

                          fwiw, to be defensive, it has forced me to always have the Mobile or web app logged in simultaneously, to be able to close positions. Though managing that with say multiple prop accounts can be a nightmare as well. The Web with grouped accounts is about the best I've found (Close button added to Positions View).
                          Thanks for your suggestion! Agreed. Next time I'll have mobile or web open for backup.
                          NT staff view seems to be, the erorrs are there to force you to fix your code. It's not that I do'nt want to fix my code. I just don't want the application to become completely unusable.
                          Thanks again

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by NullPointStrategies, Yesterday, 05:17 AM
                          0 responses
                          56 views
                          0 likes
                          Last Post NullPointStrategies  
                          Started by argusthome, 03-08-2026, 10:06 AM
                          0 responses
                          132 views
                          0 likes
                          Last Post argusthome  
                          Started by NabilKhattabi, 03-06-2026, 11:18 AM
                          0 responses
                          73 views
                          0 likes
                          Last Post NabilKhattabi  
                          Started by Deep42, 03-06-2026, 12:28 AM
                          0 responses
                          45 views
                          0 likes
                          Last Post Deep42
                          by Deep42
                           
                          Started by TheRealMorford, 03-05-2026, 06:15 PM
                          0 responses
                          49 views
                          0 likes
                          Last Post TheRealMorford  
                          Working...
                          X