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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            80 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            40 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            64 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            66 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            54 views
            0 likes
            Last Post CarlTrading  
            Working...
            X