Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order Ignored... Trap & Explain

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

    Order Ignored... Trap & Explain

    Hi,

    I occasionally trigger the following error in its multiple variations (Due mainly to rapid market movement and/or lack of detail what triggers this internal NT event):

    "...has been ignored since the stop price is less than or equal to the close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy."


    At a minimum I would like to trap this error, does this report an error code to OnOrderUpdate()? Cancelled, Rejected, etc? I didn't seem to see anything like Ignored.

    Also, can you describe what conditions NT is using to judge the order entry? I am making sure I am referencing from "High/Low" of the current bar and using CurrentAsk/Bid to get worse case, still seems to hit every once in a while. I need to catch it and reset internally to continue successfully.

    #2
    Hello NJA_MC,

    Yes, you can monitor for this after setting real time error handling to TakeNoAction. An example of custom rejection handling is available here:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Do you know what type of Error this returns to the OnOrderUpdate()? Also, can you describe the rules that NT uses to block transactions. My understanding is this error in from NT and has not been forwarded to the broker (a local reject if you would).

      Comment


        #4
        I don't seem to see any error OnOrderUpdate() trapped for this event:

        CL 7/1/2011 12:00:00 AM Time: 1/26/2011 10:24:14 AM UPDATE: stop1 Filled; ASK=91.86; BID=91.86; CLOSE=91.86; exitCondition=0; dyntrailflag1
        CL 7/1/2011 12:00:00 AM Time: 1/26/2011 10:24:14 AM GoLong; ASK=91.94; BID=91.94; CLOSE=91.94; exitCondition=0; dyntrailflag0
        CL 7/1/2011 12:00:00 AM Time: 1/26/2011 10:24:14 AM Filled Entry; ASK=91.94; BID=91.94; CLOSE=91.94; exitCondition=0; dyntrailflag0
        CL 7/1/2011 12:00:00 AM Time: 1/26/2011 10:24:14 AM UPDATE: stop1 PendingSubmit; ASK=91.94; BID=91.94; CLOSE=91.94; exitCondition=0; dyntrailflag0
        CL 7/1/2011 12:00:00 AM Time: 1/26/2011 10:24:14 AM UPDATE: stop1 Accepted; ASK=91.94; BID=91.94; CLOSE=91.94; exitCondition=0; dyntrailflag0
        CL 7/1/2011 12:00:00 AM Time: 1/26/2011 10:24:14 AM UPDATE: stop1 Working; ASK=91.94; BID=91.94; CLOSE=91.94; exitCondition=0; dyntrailflag0
        CL 7/1/2011 12:00:00 AM Time: 1/26/2011 10:27:39 AM UPDATE: stop1 PendingCancel; ASK=91.96; BID=91.96; CLOSE=91.96; exitCondition=1; dyntrailflag0
        CL 7/1/2011 12:00:00 AM Time: 1/26/2011 10:27:39 AM UPDATE: stop1 Cancelled; ASK=91.96; BID=91.96; CLOSE=91.96; exitCondition=1; dyntrailflag0
        CL 7/1/2011 12:00:00 AM Time: 1/26/2011 10:30:00 AM GoShort; ASK=91.80; BID=91.80; CLOSE=91.80; exitCondition=0; dyntrailflag0
        **NT** A BuyToCover stop order placed at '1/26/2011 10:30:00 AM' has been ignored since the stop price is less than or equal to the close price of the current bar. This is an invalid order and subsequent orders may also be ignored. Please fix your strategy.
        CL 7/1/2011 12:00:00 AM Time: 1/27/2011 3:17:29 AM GoShort; ASK=92.83; BID=92.83; CLOSE=92.83; exitCondition=0; dyntrailflag0
        CL 7/1/2011 12:00:00 AM Time: 1/27/2011 3:17:29 AM Filled Entry; ASK=92.83; BID=92.83; CLOSE=92.83; exitCondition=0; dyntrailflag0
        CL 7/1/2011 12:00:00 AM Time: 1/27/2011 3:17:29 AM UPDATE: stop1 PendingSubmit; ASK=92.83; BID=92.83; CLOSE=92.83; exitCondition=0; dyntrailflag0
        CL 7/1/2011 12:00:00 AM Time: 1/27/2011 3:17:29 AM UPDATE: stop1 Accepted; ASK=92.83; BID=92.83; CLOSE=92.83; exitCondition=0; dyntrailflag0
        CL 7/1/2011 12:00:00 AM Time: 1/27/2011 3:17:29 AM UPDATE: stop1 Working; ASK=92.83; BID=92.83; CLOSE=92.83; exitCondition=0; dyntrailflag0
        CL 7/1/2011 12:00:00 AM Time: 1/27/2011 3:17:29 AM UPDATE: stop1 Filled; ASK=92.81; BID=92.81; CLOSE=92.81; exitCondition=0; dyntrailflag0
        CL 7/1/2011 12:00:00 AM Time: 1/27/2011 4:51:39 AM GoShort; ASK=92.99; BID=92.99; CLOSE=92.99; exitCondition=0; dyntrailflag0


        As you can see above at 10:30:00AM the order was Ignored, but didn't seem to generate any OnOrderUpdate(). I need to be able to detect this event so I can re-adjust.

        Comment


          #5
          In backtesting, there's unfortunately no way to check for this. In real time it will be rejected and you can monitor for the rejection state.

          Since it's only ignored in backtesting, you will have to control submission of the order so it's not submitted at invalid prices.

          Check close price against the stop price to ensure they're submitted on right side of market. Buy stop should be >= Close price. Sell stop should be <= Close price. Maybe consider a Math.Max() and Math.Min() there to send the higher or lower of the two depending on direction.
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Hi Ryan,

            A little more information about the issue. I have carefully followed your instructions, and gone 9 Ticks future (can't find a limit that works):
            Code:
                                    m_DynStop=Math.Min(Low[2],Math.Min(Open[0],Close[0])-9*TickSize );
                                    //m_DynStop=Math.Min( execution.Order.AvgFillPrice - (stop * TickSize),GetCurrentBid()-TickSize );
                                    if (logLevel >0) debug("AveFill: "+execution.Order.AvgFillPrice +"   m_Stop :  "+m_DynStop);
                                    debug2("LONG AveFill: "+execution.Order.AvgFillPrice +"   m_Stop :  "+m_DynStop);
                                    stopOrder1     = ExitLongStop(m_TimeFrame, true, execution.Order.Filled, m_DynStop, "Longstop1", "entry1");
                                    if (stopOrder1!=null)
                                        Print("LONG Status: "+stopOrder1.Error+" Line: "+stopOrder1.ToString());
                                    else
                                        Print("LONG is NULL "+Open[0]+","+Close[0]+","+High[0]+","+Low[0]+","+Volume[0]+" StopPrice: "+m_DynStop);
            The error persists regardless of what values I put in. I think this might be due to an exception that may not be handled by NT7. The Volume happens to be 0 on that bar. It would be nice if you don't through the exception on a 0 bar if the rules have been met.

            PHP Code:
            CL 7/1/2011 12:00:00 AM Time5/3/2011 4:30:09 PM LONG AveFill111.65   m_Stop :  111.68ASK=111.79BID=111.79CLOSE=111.79exitCondition=0dyntrailflag0
            **NT** A Sell stop order placed at '5/3/2011 4:30:09 PM' has been ignored since the stop price is greater than or equal to close price of the current barThis is an invalid order and subsequent orders may also be ignoredPlease fix your strategy.
            LONG is NULL 111.77,111.79,111.79,111.77,0 StopPrice111.68 
            The other nice thing though is if this exception is thrown during back-testing, you get NULL as the returned iOrder!

            Comment


              #7
              Thanks for the details. Yes, it doesn't look like that order should be ignored based on its value compared to close.

              Volume = 0 can cause issues for NT, and most recent versions should substitute instead a value of 1. Can you check which version you're using with Help > About.

              For stop prices, these are the expressions I would use to ensure you're not submitting on the wrong side. Obviously, substitute myDesiredValue with your desired value.

              For sell stops:
              double mySellStopPrice = Math.Max(myDesiredValue, Close[0]);

              For buy stops:
              double myBuyStopPrice = Math.Min(myDesiredValue, Close[0]);
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                Hi Ryan,

                I am using 7.0.1000.6, but I am also using a Renko Hybrid to fix the volume padding of renko charts. WickedRenko is what I am using. This I know allows 0's as that is the true volume for statistically calculation.

                Comment


                  #9
                  Yes, this is likely contributing here. 0 volume bars can cause issues. It's best is to work with the bar developer to see if they can work something out. Normal NT bars will not show this as they do not allow volume 0.
                  Ryan M.NinjaTrader Customer Service

                  Comment


                    #10
                    Ryan,

                    Thanks, I will follow up with the bar developer, but this is one of the reasons for its development. It would be nice if you could pass onto the development team this exception in regards to a 0 volume as they may be able to do something in the next revision.

                    Comment


                      #11
                      NJA_MC,

                      Unfortunately nothing can be done about 0 volume at this point in time. The NinjaTrader infrastructure is not built to accept 0 volume.
                      Josh P.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by DJ888, 04-16-2024, 06:09 PM
                      4 responses
                      12 views
                      0 likes
                      Last Post DJ888
                      by DJ888
                       
                      Started by terofs, Today, 04:18 PM
                      0 responses
                      11 views
                      0 likes
                      Last Post terofs
                      by terofs
                       
                      Started by nandhumca, Today, 03:41 PM
                      0 responses
                      7 views
                      0 likes
                      Last Post nandhumca  
                      Started by The_Sec, Today, 03:37 PM
                      0 responses
                      3 views
                      0 likes
                      Last Post The_Sec
                      by The_Sec
                       
                      Started by GwFutures1988, Today, 02:48 PM
                      1 response
                      9 views
                      0 likes
                      Last Post NinjaTrader_Clayton  
                      Working...
                      X