Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Modifying a limit order that is partially filled

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

    Modifying a limit order that is partially filled

    Suppose my strategy sends a limit order to buy 2 contracts at 100 (using EnterLongLimit(2, 100, "LE")), and got one contract filled. what will happen in the following three scenarios:

    1. The strategy is unaware of the partial fill, and tries to modify the price to 99 by sending the same order with limit price set to 99, something like EnterLongLimit(2, 99, "LE");

    2. The strategy detects the partial fill, and calls EnterLongLimit(1, 99, "LE").

    3. Same as 2, but before the exchange receives the order with modified price, the previous order gets filled on the remaining contract.

    In addition, does it make any difference if "unmanaged" order handling is used?

    Thanks.
    Last edited by g22715; 05-11-2011, 06:03 AM.

    #2
    g22715, there's a difference as the unmanaged mode would not have signal tracking so the EntryHandling / EntriesPerDirection properties would not be available to limit / streamline order submission, your custom code would need to handle those.

    If the order is still working the resubmission of the order would just result in a changed limit price for the remaining qty.

    The strategy is not aware of partial fill unless you would enter the more advanced events in your code like OnOrderUpdate and OnExecution, here the explicit order properties such as fill states and filled qty's could be checked - http://www.ninjatrader.com/support/h...nt7/iorder.htm

    Comment


      #3
      Bertrand, Thank you for the reply.

      Originally posted by NinjaTrader_Bertrand View Post
      g22715, there's a difference as the unmanaged mode would not have signal tracking so the EntryHandling / EntriesPerDirection properties would not be available to limit / streamline order submission, your custom code would need to handle those.
      Yes, understood. To clarify, in scenario 1, the first order would still be modified (not duplicated) in unmanaged mode?

      Originally posted by NinjaTrader_Bertrand View Post
      If the order is still working the resubmission of the order would just result in a changed limit price for the remaining qty.
      Even in scenario 3, where the first order is filled before the second order (with different price) arrives?

      Comment


        #4
        Hello,


        This is Brett following up for bertrand.

        These are actually dependent on your broker. However in the case of scenario 1 I would expect 1 of 2 to possible happen. You would right get a rejection on the change order since it’s in the process of filling, or the remaining order that is not filled will then have its price modified.

        Same in scenario 3, I would expect you get an error message from your broker around the idea of you cannot change an order while it is in the process of being filled.

        You would then be able to handle this rejection with the unmanaged approach instead of just stopping the strategy which is default behavior in NinjaTrader.

        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment


          #5
          Originally posted by NinjaTrader_Brett View Post
          ...You would right get a rejection on the change order since it’s in the process of filling, or the remaining order that is not filled will then have its price modified.

          Same in scenario 3, I would expect you get an error message from your broker around the idea of you cannot change an order while it is in the process of being filled.
          Hi, Brett, thank you for clarifying. How do you define an order is "in the process of being filled"? when its state becomes "Working" or when it starts to get the first fill?

          Comment


            #6
            Hello,

            There is actually no order state for when its filling. Its simply a action that occurs broker side between when the order is accepted and working, when its in the process of going into state filled. This process is usually so quick that state filled is all you need to work off of. However in the rare scenario you could request the order to be changed while its in the process of filling you could run into this. I would state that I rarely run into this as it would take considerable bad luck in timing for an order to change to be sent in process of being filled. If its a large order and it takes a while to fill longer then a few microseconds then NinjaTrader will get back part filled updates on how much gets filled however.

            Let me know if I can be of further assistance.
            BrettNinjaTrader Product Management

            Comment


              #7
              To further clarify on my post below. an order is either filled or it isn't.

              The sequence of events I mention when I say being filled would be as follows:

              -Broker server was notified that this order was filled
              -NinjaTrader sends change request to broker
              -Broker sends fill to NinjaTrader
              -Broker rejects change request since order is filled and sends rejection to NinjaTrader


              There is a rare case where the above could happen and you get the rejection. However, there is logic inside of NinjaTrader that will queue all order changes and cancellations internally therefor virtually eliminating a broker change reject message.
              BrettNinjaTrader Product Management

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              663 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              376 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              110 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              575 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              580 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X