Loading…

Partial Fill Reconciler

Some ECN-style brokers do not fill a requested volume as a single ticket. Instead they hand back two, three or more separate order tickets, opened a fraction of a second apart, each carrying whatever stop and target the sending code attached to it independently. Read naively - one ticket at a time - that looks like several small, unrelated positions. A risk panel that sums "number of open trades" over counts the position, and worse, if only one fragment's stop gets moved to breakeven the others are left carrying the original risk while the trader believes the whole position is protected. This tool watches the order pool and groups tickets that share the same symbol, type and magic number and opened within a short, configurable window of each other into one logical position. It reports that group as a single entity - fragment count, total volume, and the volume-weighted average entry price, exactly the figures a trader actually cares about. Reporting alone does not fix a stop left behind on one fragment. When unification is switched on, the tool picks one canonical stop and target for the whole group - either the earliest-opened fragment's levels, or whichever fragment is currently tightest or widest - and applies it to every other fragment in the group with OrderModify, so the group finally behaves as the single position it was always meant to be. Notes and limitations - Grouping is heuristic: it assumes fragments of one intended fill share symbol, type and magic number and land within the configured window. A manual trade that happens to match all three by coincidence would be folded into the group; keep the window tight if that is a concern. - Unification sends a real modify per fragment and respects each fragment's own broker stop and freeze distance - a target that lands inside that distance is skipped and logged rather than sent. - This tool never opens or closes anything. It only reports, and only modifies stops/targets on existing tickets when explicitly enabled. - On an MQL5 netting account, grouping is trivially one fragment per symbol - see MQL4 versus MQL5 differences above.

Expert advisor · MT5 · v1.0 · Free

About Partial Fill Reconciler

Partial Fill Reconciler is an expert advisor (trading robot) for MetaTrader 5. It has a news filter. It has 7 settings, such as Magic filter, Group window seconds and Unify stops. MQL source code included.

Files in the download: PartialFillReconciler.ex5, PartialFillReconciler.mq5, PartialFillReconciler.txt.

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
Magic filter0Only group positions with this magic number (0 = all magic numbers)
Group window seconds5Max seconds between open times to treat tickets as one fill event
Unify stopsfalseActively align SL/TP across each group's fragments (modifies real positions)
Unify targetUNIFY_FIRST_TICKETWhich fragment's levels the rest are aligned to
Max retries5PositionModify attempts per fragment before giving up
Retry wait ms500Pause between retry attempts, milliseconds
Redraw seconds5Seconds between panel refreshes

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Volume · News Trading · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria