Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy fails on "current order values match" error

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

    Strategy fails on "current order values match" error

    I am running my strategy live in real account and at the same time live in Simulation mode. This error has not come up in the simulation mode ever and in fact the live simulation still has the order open currently and running without issue. However the live actual account the order threw this error and shut down the strategy:

    "Cannot change order ##### because current order values already match. affected order : (order details)"

    "Strategy: ###### submitted an order that generated the following error "Unable to change order." Strategy has sent cancel requests, attempted to close the position and terminated itself"


    I have logic in my code to set each stop to "true" and move on to the next criteria. BUT every so often based on certain criteria I will clear the stops to "false" and loop back through the criteria. With that loop......it did that and after going through the criteria and stop levels again it attempted to change the stop to the same price. Simulation accepted it.....live did not.

    I am looking for suggestions:
    1) Is there a setting in Ninja Trader that can be turned on that if an order is the same price it simply ignores the order and KEEPS running?
    2) Is there some sort of code suggestion for this?

    Any help on this is appreciated.
    Last edited by BigT4X; 01-26-2023, 08:59 AM.

    #2
    Hello BigT4X,

    Thanks for your post.

    This error message indicates that the strategy attempted to change the order to the same price value that it was already submitted at. This is likely a rule enforced by the broker which is why you see is appear on your live account and not on the simulation only account.

    You could use RealtimeErrorHandling to determine the behavior of a strategy when the strategy places an order that is returned "Rejected" or "UnableToChangeOrder". The default behavior is to stop the strategy, cancel any remaining working orders, and then close any open positions.

    RealtimeErrorHandling could be set to IgnoreAllErrors to ignore any order errors received. 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 "Unable to change" order by checking if the errorCode == ErrorCode.UnableToChangeOrder 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

    See this help guide page about OnOrderUpdate() ErrorCodes: https://ninjatrader.com/support/help...rderupdate.htm

    You may also consider checking if the current market price (Close[0]) is not equal to the price the order is already submitted at to avoid changing the order to the same price.

    Please let me know if I may assist further.
    Last edited by NinjaTrader_ChelseaB; 01-27-2023, 08:35 AM.
    <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
      Perfect....I will go through these and see how I can modify the best. IF I have questions....will use this thread. Thank you.

      Comment


        #4
        NinjaTrader_BrandonH The second link that you provided is not valid. "Page not found" error for that link. This one:

        "See this help guide page about OnOrderUpdate() ErrorCodes: https://ninjatrader.com/support/help...e.htm%E2%80%8B "​

        Could I get an updated link?

        Comment


          #5
          Hello BigT4X,

          Below is a corrected link.
          Chelsea B.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          72 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          143 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          76 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          47 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          51 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X