Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Replay Error: Stop price can't be changed above/below the market..

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

    Replay Error: Stop price can't be changed above/below the market..

    We have all seen this error when running replay. The issue is avoided when slowing replay to a CRAWL which tells me that replay cant handle speed at all which is an NT programming issue. Most of us write scripts that have a target and a stop loss that are very far away from our entry. It SHOULD BE impossible for NT to put the stop or target on the wrong side of the entry. Yes we can turn off error detection but we should not have to as the error shouldn't happen. Even at 100x I'm getting the error on Replay which makes replay Useless. When are you going to put some programming time to make replay better so it can run at Max speed.
    Anyone able to run any scripts with SL and PT at max speed? It seems the crash less when the target and SL are farther away from the entry.
    This error ONLY happens on replay and not live. How is that possible??? Except a speed issue. NT needs to deal with WAY faster speeds.
    Last edited by AmberBamber1999; 11-01-2023, 02:52 PM.

    #2
    Hello AmberBamber1999,

    Thanks for your notes.

    This error message means that the strategy attempted to place an order to the wrong side of the market.

    This can be seen in moments of higher volatility when the stop price is moved too close to the current market price, where the current market price can move back before the order change gets processed.

    Note that 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.

    You could increase the distance of the stop loss/profit target so it is further away from the market and this kind of error would be less often seen.

    Are you updated to the current version of NinjaTrader Desktop (8.1.2.0)?​​

    To clarify, have you added debugging prints to your strategy to confirm that the price being supplied to the stop order method and the price being assigned to the target order method is on the correct side of the market when you see this error appear?

    One line above where the stop/target order methods are being called, print out the price being submitted to the order and print the Time[0] and CurrentBar.

    Below is a link to a forum post that demonstrates how to use prints to understand behavior.
    https://ninjatrader.com/support/foru...121#post791121

    Something you could consider is using GetCurrentBid() and GetCurrentAsk() to offset orders so that they are more likely to land on the correct side of the market.

    See these help guide pages for more information.
    GetCurrentBid(): https://ninjatrader.com/support/help...currentbid.htm
    GetCurrentAsk(): https://ninjatrader.com/support/help...currentask.htm

    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​​
    <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


      #3
      I already know all of this in your post. It DOESNT happen playing live at reg mkt speed. It ONLY happens on REPLAY at faster speeds. We need NT to program it to handle Replay trades better at faster speeds please. Did I explain this correctly?
      Last edited by AmberBamber1999; 11-02-2023, 08:56 AM.

      Comment


        #4
        Hello AmberBamber1999,

        Can you provide print output printing the time, the value of GetCurrentAsk() / GetCurrentBid(), and the stop price you are using for the order?

        From my understanding the playback should process all data in order no matter the playback speed.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          OK I've found PROOF and already filed a ticket with NT and they confirmed some data is WRONG. This error has happened on my Replay a LOT and NT always says the same thing about it being my script or code or something and ITS NOT TRUE! The data isnt downloading right into Replay OR the data you have is corrupt. NT now has proof and has submitted it to the data team. So take note traders! IT'S NOT YOU! THIS IS AN NT/DATA ISSUE. Please keep sending them tickets. Replay is USELESS until this is fixed. If you want to run a week, month or 60 back test.

          Comment


            #6
            Just as a bump this is still going on. I have to manually watch and make sure no error happens so i can skip to the next day. It sucks but it's the only way to get level 2 data in backtesting as far as i know.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            110 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            59 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            37 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            41 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            78 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X