Implementation guide · Order Execution
Partial Fills and Volume-Weighted Execution Price
Reconcile original, filled and remaining order quantity across multiple executions, with a weighted-price example and duplicate-event checks.
Published Updated
Published by FxTrusts, a supplier of brokerage and prop firm technology. Prepared with AI-assisted research and drafting; reviewed against the cited public sources. Examples are illustrative. Product links describe our services.
Quick answer
A partial fill executes only part of an order’s quantity. The volume-weighted execution price equals the sum of each fill’s quantity multiplied by price, divided by total filled quantity. Reconcile original, cumulative and remaining quantities separately from the order’s current status.

Treat every fill as a distinct event
One order can produce several executions, each with its own identifier, quantity, price and timestamp. An average price summarizes them but cannot replace the underlying records. MetaTrader distinguishes orders, deals and positions, while FIX models execution reporting separately from the submitted instruction. An integration should preserve those relationships so that a later cancellation or correction can be traced to the correct event.
Reconcile quantities before calculating the average
Under a simple unamended order, original quantity equals cumulative filled quantity plus remaining quantity while the remainder is active. If it is canceled, the canceled quantity must also be accounted for. Amendments, corrections and busts can change the reconciliation, so retain the relevant order version. Never interpret a terminal canceled status as proof that the order had no earlier fills. That mistake can cause an unintended replacement for an already executed amount.
Use filled quantity as the denominator
The weighted average includes executed quantity only. If an order for 100 units has filled 60, divide the fill-value sum by 60, not by the original 100. A simple arithmetic average of fill prices is also wrong when fill quantities differ. Retain adequate precision through the calculation and apply the documented display or booking rounding rule afterward. The contract’s price and quantity units must be compatible with the calculation.
Protect reconciliation from repeated messages
A recovered connection or delayed notification can deliver the same execution more than once. The economic fill should be booked once even if its message is seen repeatedly. Use the source’s stable identifiers and correction semantics rather than assuming every incoming message represents new volume. If an identifier is reused or ambiguous, compare the source documentation and retain the raw event for investigation instead of silently adding it to the totals.
A partly completed order with three fills
Assume an original order for 100 linear units receives fills of 20 at 50.00, 30 at 50.10 and 10 at 50.20. The filled-value sum is 3,005 and the filled quantity is 60, giving 50.083333… as the weighted execution price. Forty units remain active under this example’s policy. This average says nothing about the future price of those remaining units.
| Fill | Quantity | Price | Value |
|---|---|---|---|
| A | 20 | 50.00 | 1,000.00 |
| B | 30 | 50.10 | 1,503.00 |
| C | 10 | 50.20 | 502.00 |
| Filled total | 60 | Weighted 50.083333… | 3,005.00 |
| Unfilled remainder | 40 | Not executed | Not included in average |
Implementation checklist
- Preserve order, execution and position identifiers separately.
- Reconcile filled, remaining and canceled quantities for the relevant order version.
- Divide by executed quantity, not the original requested amount.
- Deduplicate replayed executions and process corrections under the source’s documented rules.
Sources
These documents support the reference. Check the original publication for current requirements and the limits of its scope.
- MetaTrader 5 trading principleswww.metatrader5.com
- FIX Latest as of EP284: Trade specificationwww.fixtrading.org
- FIX Latest as of EP284: Order State Changeswww.fixtrading.org
Continue with the broader guides
Connect this reference to platform selection and the wider operating workflow.
