Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Detect NT internal order rejection

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

    Detect NT internal order rejection

    Hi Guys,

    I have an issue where I am using Unmanaged order handling, and receiving a sporadic issue of NT denying a stop limit order because the stop price is above / below the market (depending on the direction). This is fine, as I expect it to happen in some fast moving markets, but is there a way to catch it via code so I can properly handle it?

    I don't believe its a rejected order.

    Any assistance is appreciated, as always.
    mrlogik
    NinjaTrader Ecosystem Vendor - Purelogik Trading

    #2
    This is very prescient because I was just about to post the exact same question.

    I am also running into the same problems where I generate orders (Buy/Sell Stop Limit) and sometimes they get rejected.

    1) What can I do in this situation to catch them and recover from it
    2) More importantly, how do I reproduce this situation to test? I can't test it on market simulator because it moves too slowly. What mechanism can I use to test this because it's very critical to me?

    thanks,

    Steve

    Comment


      #3
      Hello,

      Thanks for your note.

      Yes you can catch it with OrderState.Rejected with the iOrder object of the stop order. Since the stop order is rejected you can catch it with this and then take some action to try and attempt to resubmit and a lower price. Would suggest that you put a limit to the amount of rejection resubmits you allow as well.

      As if you get into a case where the rejection is due to some other account issue or not able to submit due to inefficient funds for example. You could get in a loop where you are constantly submitting orders that get rejected which could cause issue/non ending loop.

      Let me know if I can be of further assistance.
      BrettNinjaTrader Product Management

      Comment


        #4
        Hi Brett,

        The situation I am talking about doesn't come up as a Rejected Order.

        It says "Limit price can't be smaller than stop price" OR "sell stop or sell stop limit can't be place above the market"

        In the OnExecution() Method, I'm not getting any kickback or Rejected order to catch.

        I may be missing something simple; thoughts?
        mrlogik
        NinjaTrader Ecosystem Vendor - Purelogik Trading

        Comment


          #5
          Hello,

          You should get a rejected order I believe. Can you check the log and the order status reported in the log when the order was tried to be submitted?

          Also is this on the Sim101 account or live?
          BrettNinjaTrader Product Management

          Comment


            #6
            Also, double checking you have this set correct.

            BrettNinjaTrader Product Management

            Comment


              #7
              Hi Brett,

              I do have it set to Take No Action, but I'm checking the order status for Rejected in the OnExecution() method.

              I'll have a look at using the OnOrderUpdate() method.
              mrlogik
              NinjaTrader Ecosystem Vendor - Purelogik Trading

              Comment


                #8
                Hello,

                Also, send me the log file to support at ninjatrader dot com ATTN: Brett. I can then take a look a tthe rejection(Or lack thereof) in the log and tell you exactly whats needed to capture it.

                I look forward to assisting you further.
                BrettNinjaTrader Product Management

                Comment


                  #9
                  Hey Brett,

                  I had to use the OnOrderUpdate() method, rather than the OnExecution() method to detect the Rejected Order.

                  Its working now. Thank you for your support.
                  mrlogik
                  NinjaTrader Ecosystem Vendor - Purelogik Trading

                  Comment


                    #10
                    Hello,

                    Excellent. Thanks for posting the solution for others.

                    Have a great rest of the day.
                    BrettNinjaTrader Product Management

                    Comment


                      #11
                      One further question, under what circumstances does a Limit or Stop Limit get rejected? For example, for a long order, if the limit price is greater than the bid, will it get rejected? Or is it the Ask?

                      For example, if the Bid is 100.00 and the Ask is 100.10, and a buy limit order is sent for 100.20, will this get rejected, or will it get filled at 100.10?

                      Also, under the same circumstances, with the Bid/Ask being 100/100.10, as what price is the minimum that the Buy Stop Limit order and stop price can be set to?

                      Thanks,

                      Steve

                      Comment


                        #12
                        Hello,

                        Limits orders in trading will almost never get rejected based on price action.

                        Stop orders can since the need to be at a valid price below the market or above the market depending on if your wanting to go long or short.

                        The best solution here is just to make sure when you submit your stoploss to make sure its a few ticks away from the current price so that it does not get rejected.

                        Also, there are many reasons why orders can get rejected due to risk management settings, to auth setttings, to invalid order type combinations.

                        Best to contact your broker for clarification on what they could reject orders on.
                        BrettNinjaTrader Product Management

                        Comment


                          #13
                          Thanks for the quick response. Okay thanks I will contact me broker on this.

                          One bonus question: how do I go about actually testing this? When I place my Buy Stop Limit order, I do this several ticks away from where the price action currently is. About once or twice a month, the orders get rejected because in the time between sending the order and it getting accepted, sometimes the price jumps up at or past the order price.

                          Is there a recommended way I can test this? Using the market simulator doesn't work at all because the price doesn't move fast enough. Is there a way I can manufacture data and then push it through the market replay adapter?

                          thanks,

                          Steve

                          Comment


                            #14
                            Hello,

                            Sorry, really no way to test that I can think off.

                            Let me know if I can be of further assistance.
                            BrettNinjaTrader Product Management

                            Comment


                              #15
                              Stevent,

                              Just throw your strategy on a symbol with fast price action, typically on a small range bar. It doesn't matter if its good for you system, or something you would trade, just a simple unit test.
                              mrlogik
                              NinjaTrader Ecosystem Vendor - Purelogik Trading

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              647 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              368 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              108 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              571 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              573 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X