Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Partfilled vs Filled

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

    Partfilled vs Filled

    I would be most grateful for clarification of the correct way to handle partial order fills (Order.OrderState == OrderState.PartFilled) and order fills (Order.OrderState == OrderState.Filled) for the same submitted order to ensure an accurate fill count (using Order.Quantity) and average fill price (using Order.AvgFillPrice) across multiple partial fills. This is using a Managed order approach.

    Here is my understanding of the situation -- please correct me where I am in error:
    • The PartFilled Quantity is the quantity of that partial fill only, not the accumulated quantity of all partial fills to date
    • The Filled Quantity is either:
      • The full quantity of the original submitted order if there are no partial fills, or
      • The remainder of the submitted quantity after all partial fill quantities have been accumulated

    • To determine when a submitted order has been completely filled, the fill update and any partial fill updates must all be used
    • To accurately calculate the quantity when there is one or more partial fills, sum the quantities of every partial fill and the final fill
    • To accurately calculate the average fill price when there is one or more partial fills, pro rata the average fill price of each fill to obtain a final average fill price
    • The way partial fills and fills work is identical for all order types (i.e. the same for Enter and Exit orders for Market, Limit, Stop and StopLimit, as well as Trailing Stop and Profit Target)
    • When handling partial fills and fills in OnOrderUpdate, sometimes a fill update may arrive before a partial fill update -- one must compare the submitted quantity against the fill update quantity to determine if partial fill updates may follow.

    Here are some examples of calculating quantities and average fill price:
    • Fill only (no partial fills)
      • Enter Quantity = 100
      • Fill, Quantity = 100 @ 1.12 avg fill price

    • PartFill + Fill
      • Enter Quantity = 100
      • Partial fill, Quantity = 20 @ 1.00 avg fill price
      • Fill Quantity = 80 @ 1.20 avg fill price
      • Total Quantity = 20 + 80 = 100
      • Average fill price = ((20 x 1.00) + (80 x 1.20)) / 100 = 1.16

    • PartFills + Fill
      • Enter Quantity = 100
      • First partial fill, Quantity = 20 @ 1.00 avg fill price
      • Second partial fill, Quantity = 20 @ 1.10 avg fill price
      • Fill Quantity = 60 @ 1.20 avg fill price
      • Total Quantity = 20 + 20 + 60 = 100
      • Average fill price = ((20 x 1.00) + (20 x 1.10) + (60 x 1.20)) / 100 = 1.14


    Many thanks for advice to correct any misunderstandings I may have.
    Last edited by jeronymite; 05-17-2014, 05:58 AM. Reason: Update to say it's a Managed approach
    Multi-Dimensional Managed Trading
    jeronymite
    NinjaTrader Ecosystem Vendor - Mizpah Software

    #2
    Jeronymite,

    an accurate fill count (using Order.Quantity)
    Order.Quantity will return the order's quantity. Instead you would want to use Order.Filled This will represent the filled amount of the order

    To determine when a submitted order has been completely filled, the fill update and any partial fill updates must all be used
    The OrderState.Filled will get called in a complete fill of the order. You would not need to use the PartFill for this.

    The rest would be an accurate assessment.

    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Order.Filled is all you really need?

      Many thanks, Cal.

      The Order.Quantity was a typo on my part -- Order.Filled is obviously what is needed.

      As for the use of Order.Filled, I presume that one does not need to explicitly handle partial fills (unless one wants to for some reason), and one can simply wait for the Order.Filled and it will contain an accurate count equal to the submitted Quantity and an accurate average fill price, equal to the appropriately pro rata'ed individual fills if partial fills occur. Is that correct?

      Thanks.
      Multi-Dimensional Managed Trading
      jeronymite
      NinjaTrader Ecosystem Vendor - Mizpah Software

      Comment


        #4
        Hello Jeronymite,

        Your understanding is correct here. The Filled will return when the order has been completely filled and you will get the Avg price of that orders' entries.

        Let me know if I can be of further assistance.
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        648 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X