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

FALSE(fake) Stop price order rejected (when running Market Replay with playback)

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

    FALSE(fake) Stop price order rejected (when running Market Replay with playback)

    Hello,

    Getting FALSEfake) Stop price order rejected When running Market Replay with playback .
    When running the same script with playback in historical mode its seem that there is no problem.

    The Error pop up windows that I received “ Stop price can’t be changed above the market ….”
    This is false(fake) error because my stop order for long position was 2 cents bellow the bid price.

    Also printing from the order state the Bid & ask and my stop & and stop limit price shows that there is no problem and that the order state never reached to “Rejected”.

    The NT trace log file show that there is no problem and that the order state never set to “Rejected”

    I wrote a test script for this issue and debug it Please see attached file DbgStgStopOrderRejected.cs
    I also ran the script with “RealtimeErrorHandling = RealtimeErrorHandling.IgnoreAllErrors;“

    I ran the script with debagger and I insert a breakpoint in OnOrderUpdate function
    Inside the case of “if (order.OrderState == OrderState.Rejected || order.OrderState == OrderState.Unknown)
    Please see attached file “Debug_breakpoint.png”
    The debugger Never insert to the order rejected case.

    As I wrote the problem is when running Market Replay with playback .
    In order to reproduced this its need to give it a time to happened ,please see attached file for my script test.

    For example you can test with market replay the AAL at 03/04/2019

    Sincerely, Kobi
    Attached Files

    #2
    Hello levikNT,

    AAL Market Replay data is not available to download from NinjaTrader's Market Replay servers. Did you record this as Market Replay data yourself?

    Are you instead using historical tick data in the Playback connection?

    If so, who are you connecting to for data?

    Are you printing all market data updates from OnMarketData() to show the bid or ask update in line with the rejection message in the output window?

    (It looks like you may be printing the next ask and bid updates after the rejection has occurred from OnOrderUpdate()..)
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea B.
      Thank you for your response.

      I recorded level 2 live stream market data by connected to Kinetic for level 2 data.
      I recorded a list of stocks using the market analyzer and in order to record level 2 market data I added indicator which use OnMarketDepth to the market analyzer.

      The AAL stock is only an example of the problem which came up in other stocks as well.

      As I wrote I tested my script using Market replay data and also in historical tick data as well in the Playback connection.

      The problem arises using Market replay with playback connection.
      Right know in historical tick data there is no problem.

      As I wrote before in the opening thread the print is from OnOrderUpdate()

      I also ran the script with debagger and I insert a breakpoint in OnOrderUpdate function
      Inside the case of “if (order.OrderState == OrderState.Rejected || order.OrderState == OrderState.Unknown)
      Please see attached file “Debug_breakpoint.png”

      The debugger Never insert to the order rejected case.


      Sorry, Please read again my opening thread .

      Have you looked at the files that I provided : NT trace, playback image, my strategy script test???

      Looking in the trace log every thing is OK ,the debugger did not stop in OnOrderUpdate inside the case of
      "if (order.OrderState == OrderState.Rejected || order.OrderState == OrderState.Unknown)"

      Please see attached files.


      looking forward for your finding.

      Sincerely, Kobi
      Attached Files

      Comment


        #4
        Hello Kobi,

        Thank you for confirming that you have recorded Market Replay data from a live Kinetick connection.

        What this means, is that I will not be able to test over the same data set as I do not have this recorded.

        Are you able to reproduce the behavior using a future or forex instrument that is available to download from NinjaTrader's Market Replay servers?

        I would like to be able to test over the same exact instrument and date and time to reproduce the error.

        Further, your script does not confirm the ask or bid price the order was rejected with. Instead you are printing the current snapshot of the ask and bid after the order is already rejected where the price may have already changed. This does not confirm the price the order was rejected with..


        Unfortunately, the trace file does not contain the ask, bid, or last prices when an order is rejected.

        If an order is rejected, NinjaTrader saw that orders price on the wrong side of the market. We now need to find out why by viewing the prices.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hello Chelsea B.

          Thank you for your response.

          Suppose the order was rejected for the correct reason, I still had to see the prints from OnOrderUpdate() of the order state that the order was rejected.
          But on the contrary, the printing of the order state in the OnOrderUpdate() shows that all the all state passed all (Initialized,Submitted,Accepted...)
          There is no printing for order state rejected.
          In addition to that the trace log show the same and there is no order rejected in the log.

          also when I ran it with debugger an I put a break point In OnOrderUpdate() inside the case of
          if (order.OrderState == OrderState.Rejected || order.OrderState == OrderState.Unknown)

          the Debugger didn't stop in this break points.

          so, even if the orders price on the wrong side of the market I still had to catch it in OnOrderUpdate() and see in the trace or error log
          that the order has been rejected.


          as I said this behavior is happen with other stock as well, for example if the stop price is bellow the bid by 2 cent for long position.

          In order to reproduce this behavior you should run my script test with number of strategy using playback with max speed ,
          and I suppose that it should be happened.

          Sincerely, Kobi

          Comment


            #6
            Hello Kobi,

            The order would only trigger OnOrderUpdate() if the RealtimeErrorHandling is set to .IgnoreAllErrors or .StopCancelCloseIgnoreRejects and the strategy keeps running instead of being disabled.

            Is the strategy becoming disabled?

            However, any rejected order in real-time would be in the Log. If you are able to reproduce an order being rejected in real-time and this is not appearing in the log, I would like to schedule a call with you so that I may observe and record this behavior, get steps to reproduce, and then report the behavior to our development.
            At this time on my end I am not able to reproduce this behavior. All real-time order rejections are appearing in the NinjaTrader 8 Log tab of the Control Center on my end, even when testing the ES 06-18 Market Replay data in Playback with a custom script I have created to test rejections.

            As far and working to find where the strategy is being disabled, I am not able to do debugging on your behalf.
            If you have a specific instrument and specific time and date that I can test this over, I would be happy to at least make a video that shows the ask and bid prices before and during the rejection to confirm that the order is being placed on the right side of the market. In a fast moving market, its very possible for the ask or bid price to change just as an order is being submitted and have that order be rejected. Your are peaking at the unprocessed snapshot of the ask or bid after the order is rejected. It does not appear you are looking at the processed ask or bid at the time the order is submitted.
            I will not be able to test over AAL Market Replay data as this data is not available to me.

            Instead of breakpoints which would skew different threads running at different speeds (such as a script and GetCurrentBid() which returns a snapshot of unprocessed data in a different thread), use prints and print each market data update.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hello Chelsea B.

              Thank you for your response.

              In my Strategy the RealtimeErrorHandling is set to IgnoreAllErrors as tou can see from the script test that I provided.
              However as you responded ,"any rejected order in real-time would be in the Log".

              I can reproduce an order being rejected in real-time and this is not appearing in the log.
              I will be happy to schedule a call with you.

              I will also prepare for this schedule call, number of stocks that show the problem.

              Sincerely, Kobi

              Comment


                #8
                Hello Kobi,

                Please send an email to platformsupport [at] ninjatrader [dot] com with a link to this forum thread so that we may schedule a call to demonstrate real-time orders rejections are not being logged.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Barry Milan, Yesterday, 10:35 PM
                5 responses
                16 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by DanielSanMartin, Yesterday, 02:37 PM
                2 responses
                13 views
                0 likes
                Last Post DanielSanMartin  
                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
                8 views
                0 likes
                Last Post nandhumca  
                Working...
                X