Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8B10 Order fill resolution = High creates order execution errors

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

    NT8B10 Order fill resolution = High creates order execution errors

    I`ve found this issue/bug with one of my strategies and I`ve uploaded a sample strategy for testing at your end.

    The sample strategy is a modified copy of “SampleMACrossOver”. This strategy uses StopMarket orders to enter and exit the market.

    When I run the strategy, with Order fill resolution = Standard I get these results: CL##-## Net Profit = $1200, YN ##-## Net Profit = $3,500

    When I run the strategy, with Order fill resolution = High (1 minute) I get these results: CL##-##, Net Profit = -$3,880, YN ##-##, Net Profit = $5,480

    CL ##-## Log Error: Strategy 'MySampleXCross/-1': A Sell stop order placed at '1/23/2015 3:00: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.

    YM##-## Log Error: Strategy 'MySampleXCross/-1': A BuyToCover stop order placed at '1/28/2015 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.
    Notice the Net Profit results are different by $1000`s of dollars and the error messages.

    When you look at the code, the Stoploss orders are calculated from the Entry order AverageFillPrice +/- 15 ticks, and only fail when Order fill resolution = High.

    Can you pls have look at the upload and test the sample strategy at you end, and let me know if this is an NT8B10 bug/issue when running Order fill resolution = High...

    Why the results are so completely different when using Order fill resolution = High ?

    What is causing the Stoploss order Errors on the log ?

    Thank you
    Attached Files

    #2
    Hello Support

    Is it possible that you can look into this today ?

    Pls let me know

    Comment


      #3
      Hello,

      Thank you for the post.

      I will review the post and reply back once I have had further time to review the script as well.

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Hello,

        I have further reviewed the scenario and the script.

        The changes in results could be expected as the backtest fill resolution is changed between the two tests. In the image I see that you are comparing a 30 minute series against the high fill resolution of 1 minute. While testing on my end I can see that when I do this the fill prices are changed resulting in differences in the overall PnL. To identify specifically why the results are different you would need to review the individual executions and how they are different from the test that did not use high fill resolution.

        Regarding the StopLoss, have you tried Printing the values at the time of this event to ensure the values are valid?

        Based on the error message it seems at the time the price used is not a valid price that could be accepted so the order is ignored. You could utilize a Print like the following in the conditions to identify if all values at the time of the logic being executed are correct.

        Code:
        Print("ExitLongStop: " + dblStopPrice + " | " + Close[0] + " | " + Time[0]);
        This would make a print that shows the Price used for the stop, the close at that time and the Time.

        While testing this I could see that some values were being calculated above the current close, here is an example of the above print:

        ExitLongStop: 1891.25 | 1888.25 | 1/28/2016 10:00:00 PM
        The stop price in this case was above the close of the bar where the logic became true, this resulted in the ignored order.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          I have inserted printed statements, as you recommended. And I reran MySampleXCross for 2 days, 1/8/2015 - 1/9/2015.

          Pls see uploaded screen prints.

          See: Standard Resolution.JPG & Standard Resolution Chart.JPG

          The strategy was run with Order fill resolution = Standard Resolution and created 2 trades, creating a loss of -$300 using 2 stop orders that are below Close[0]
          ExitLongStop: 49.23 | 49.33 | 1/8/2015 7:00:00 PM
          ExitShortStop: 48.72 | 48.8 | 1/9/2015 6:30:00 AM

          See: High Resolution.JPG & High Resolution Chart.JPG
          The strategy was run with Order fill resoltuoin = High (1 minute) and creating the same 2 trades, but now with a profit of +$240.00 using the same 2 stop orders that are below Close[0]. BUT the second ExitShortStop received the error anyway, even though the trades where identical and the print confirms it.
          ExitLongStop: 49.23 | 49.33 | 1/8/2015 7:00:00 PM
          ExitShortStop: 48.72 | 48.8 | 1/9/2015 6:30:00 AM
          Strategy 'MySampleXCross/-1': A BuyToCover stop order placed at '1/9/2015 6: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.
          I understand your point about why the results could be different due to the order fill resolution being reduced from 30 min to 1 min.

          But if you look at the 2 uploaded Charts, you see that ExitShortStop for the High Resolution Chart test was erroneously ignored, allowing the 2nd trade to "Exit on session close", therefore allowing it to be profitable instead of a loss as it is on Standard Resolution Chart. (see yellow marks on charts)

          NT produces this LOG ERROR with the Order fill resolution = HIGH, in error, when there should NOT be one.

          Can you please confirm this as a bug or explain why order fill resolution produces this error when the prices of both Close[0] and ExitShortStop are correct and identical between the 2 tests ?

          Thank you
          Attached Files

          Comment


            #6
            Hello,

            Thank you for the reply.

            I have submitted this to development for further review, If i have further details I will reply back to this post.
            JesseNinjaTrader Customer Service

            Comment


              #7
              Hello,

              Its been a few days.

              Has there been any word back from development about this issue.

              Thank you

              Comment


                #8
                Hello,

                I reviewed this further with product management and it was determined this is currently due to the logic in the script.

                The script is using the LiveUntilCancelled overload which includes a BarsInProgress index, the orders are being submitted specifically to the BarsInProgress 0 which prevents the order from being filled on the secondary series when High resolution is used. This creates a situation where the order price is invalid and the error is reporting correctly.

                This also brought up another point regarding the overload sets for these type of orders which is now being looked into.

                For the time being, the work around would be to either utilize a strategy that is specifically built for intrabar granularity or adds a 1 minute series its self, you could then use the standard fill. Or if you want to use high resolution, you would need to ensure that the correct BarsInProgress is referenced instead of 0. You could set up a user defined input bool property or int to toggle this specifically while in a backtest using High fill resolution.

                I look forward to being of further assistance.
                JesseNinjaTrader Customer Service

                Comment


                  #9
                  Hello NinjaTrader_Jesse

                  Thanks for the explanation. Now its clear to me what is happening when I execute an SA with Order Fill Resolution set to HIGH. The behind the scenes addition of another dataseries coupled with order using the LiveUntilCancelled overload now makes sense.

                  This is the workaround that I implemented

                  if (OrderFillResolution == OrderFillResolution.Standard)
                  {
                  EnterShortStopMarket(0, true, IntTradingQty, GetCurrentBid() - dblGet_Ticks(IntOpeningEntryTicks), cstrSignalName_SellEntry);
                  }
                  else
                  {
                  EnterShortStopMarket(1, true, IntTradingQty, GetCurrentBid() - dblGet_Ticks(IntOpeningEntryTicks), cstrSignalName_SellEntry);
                  }
                  I've uploaded the same strategy with the fixes in place on both the Entry and SL methods for anyone that is interested.

                  Thank you
                  Attached Files

                  Comment


                    #10
                    Hello rayko,

                    This behavior will be resolved for Beta 12 in #9865: "Stop price checks for strategies with OrderFillResolution=High had been executed on the wrong bars series".

                    Thank you for your patience in the meantime.
                    Michael M.NinjaTrader Quality Assurance

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by ketostrongdiet, Today, 12:34 AM
                    0 responses
                    6 views
                    0 likes
                    Last Post ketostrongdiet  
                    Started by ketostrongdiet, Today, 12:33 AM
                    0 responses
                    7 views
                    0 likes
                    Last Post ketostrongdiet  
                    Started by mattdowns1234, Yesterday, 06:57 PM
                    0 responses
                    16 views
                    0 likes
                    Last Post mattdowns1234  
                    Started by dgee949, Yesterday, 06:26 PM
                    0 responses
                    26 views
                    0 likes
                    Last Post dgee949
                    by dgee949
                     
                    Started by dgee949, Yesterday, 05:58 PM
                    0 responses
                    32 views
                    0 likes
                    Last Post dgee949
                    by dgee949
                     
                    Working...
                    X