Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What Happens When a ChangeOrder() Request is Rejected?

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

    What Happens When a ChangeOrder() Request is Rejected?

    Hello Ninjatrader staff,

    I have two questions about order behavior. My strategy is set to Unmanaged Approach and RealtimeErrorHandling.IgnoreAllErrors.

    1. When a ChangeOrder() request is triggered in the strategy, but for whatever reason the ChangeOrder() can't be completed (market data lag, poor script logic), does the order that I wanted to change remain in place where it was before I tried to change it? Or does the order get cancelled?

    2. In the same scenario as above, when a ChangeOrder() request is "rejected" for whatever reason, does this rejection trigger the OrderState.Rejected state in OnOrderUpdate?

    Thank you in advance for your time, I look forward to your reply.

    GLFX005

    #2
    Hi GLFX005, thanks for writing in.

    1. If an order is unable to be changed you will get an ErrorCode.UnableToChangeOrder in OnOrderUpdate.
    2. If the order is changed to an illegal price level, it will still get the ErrorCode.UnableToChangeOrder.

    Please let me know if I can help any further.
    Last edited by NinjaTrader_ChrisL; 07-07-2022, 11:18 AM.

    Comment


      #3
      Hello Chris,

      Thank you for your reply.

      Forgive me, but I don't understand the second answer very well. How can an order first be changed, succesfully, and then become rejected? Also, what happens to the actual order when a ChangeOrder() is rejected, since the order already exists? Does it simply stay in place, or does it become cancelled?

      Comment


        #4
        Hi GLFX005, sorry for the oversight. I just tested and It will never complete the change. If you change the order to an illegal price level the ErrorCode.UnableToChangeOrder order will be shown before the order has a chance to get rejected.

        Comment


          #5
          Hello Chris,

          Thank you again for your explanation, I believe I'm starting to get a clear picture of what's going on under the hood.
          So if I understand this correctly, a failed ChangeOrder() can never result in an OrderState.Rejected? Instead of that scenario, the failed ChangeOrder() can only result in an ErrorCode.UnableToChangeOrder, meaning that the order is still alive in its original place?

          Comment


            #6
            Hi GLFX005, That is correct. The order will stay where it was before the ChangeOrder command was submitted.

            Kind regards,
            -ChrisL

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, 03-13-2026, 05:17 AM
            0 responses
            88 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            151 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            80 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            53 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            62 views
            0 likes
            Last Post TheRealMorford  
            Working...
            X