Loading…

Copy Performance Divergence Reporter

A slave account that "looks about right" against its master can still be quietly bleeding an avoidable amount every month, and a single "we're down 3% versus the master" figure gives no clue whether that is bad fills, a badly-chosen lot ratio, or trades the slave simply never took. Attached to the master's chart with InpRole set to MASTER, this EA logs every one of its own closed trades to a shared file the moment they close. Attached to the slave's chart with InpRole set to SLAVE (and InpMasterInstanceTag pointing at the master's tag), it reads that shared log, matches each master trade to the slave's own closed-trade history by symbol, direction and open-time proximity, and computes two separate numbers for the running gap: a SLIPPAGE component derived purely from the price difference at open and close (independent of lot size), and a CONFIGURATION component covering everything else - lot-ratio mismatch, trades the master took that the slave never matched (missed), and trades the slave took with no corresponding master trade (extra). A trade that cannot be matched within the configured time window is never silently folded into one of the totals as a guess; it is counted and reported separately as missed or extra. This does not attempt to fix the gap, only to say honestly which of the two very different problems - a broker/latency issue versus a configuration issue - is actually driving it, since the fix for each is completely different. Notes and limitations - Assumes the master and slave trade the same symbol NAME. Suffix or broker-mapping differences are out of scope here; pair this with the Auto Learning Symbol Mapper project elsewhere in this catalogue if the two brokers use different symbol names. - The MASTER side only logs trades that close AFTER the EA is first attached for a given tag - it deliberately does not dump the account's entire pre-existing history into the shared log on first run. - The slippage/configuration split is an honest approximation, not an audited accounting split - it is documented plainly in this file so it is not mistaken for one. In particular the configuration component is a residual (whatever the slippage figure does not explain), so any error in the slippage estimate shows up there too. - Two trades closing in the exact same second could, in a rare edge case, have one skipped by the master's watermark logic. Acceptable for a reporting tool, not something a trading-critical process should rely on. - Reimplements its own NormalizeLots-style money-per-point helper and shared-file append pattern inline rather than including another project's file, per this catalogue's no-cross-project-include rule.

Expert advisor · MT5 · v1.0 · Free

About Copy Performance Divergence Reporter

Copy Performance Divergence Reporter is a script for MetaTrader 5 based on Divergence. It has 9 settings, such as Role, Instance tag and Master instance tag. MQL source code included.

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

Settings

SettingDefaultWhat it does
RoleROLE_SLAVEWhich side of the copy relationship this chart plays
Instance tagShared filename tag for THIS master; blank = auto from account number (MASTER role only)
Master instance tagThe MASTER's tag to read from (SLAVE role only) - must match the master's own InpInstanceTag
Magic filter00 = count every closed trade; otherwise only this magic number
Poll interval sec5Seconds between rescans of history / the shared log
Max tracked trades300Cap on how many recent closed trades either side keeps in memory
Match window sec300A slave trade must have opened within this many seconds of the master's matching trade to be paired
Assumed lot ratio0.10Lot ratio assumed for a MISSED master trade's configuration-impact estimate (no slave fill exists to
Report file nameCopyDivergenceReport.csvThis account's own MQL5\Files\ output (SLAVE role only)

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 → Scripts.
  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 script onto a chart to run it once.

Download the PDF guide

Tags: Divergence · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria