Loading…

Funded Account Sync Shield

A trader running several funded accounts side by side under one broker's multi-terminal install wants them all trading the same underlying idea, but each account has its own balance, its own remaining drawdown buffer and its own rule limits - copying raw lot sizes from one account to another is usually wrong the moment the balances differ. This EA runs in exactly one of two roles, chosen explicitly with InpRole and never auto-detected: PUBLISH turns this account into the master. On a timer it sums every currently open order's signed lots (buy positive, sell negative) per symbol - across every magic number, since the whole account's trading is what should be mirrored - and writes one row per symbol with non-zero net exposure to a shared CSV file in MQL4\Files\ (or MQL5\Files\ on the native MQL5 build)Common, along with this account's current equity. It places no orders itself; it only reports. FOLLOW turns this account into a mirror. On a timer it reads that shared file, scales each symbol's published net lots by (this account's equity / the publisher's equity), caps the result at InpMaxLotPerSymbol and InpMaxTotalLots, and resyncs by fully closing this EA's own tagged orders on that symbol and reopening fresh at the new target size - simpler to reason about and audit than nudging individual tickets, at the cost of paying the spread again on every resync. Only orders carrying this EA's own InpMagicNumber are ever touched, so other manual or EA activity on the follower account is left alone. If the signal goes stale - the publisher stopped running, or the file cannot be read - the follower alerts once and, if InpFlattenOnStaleSignal is true, closes its own mirrored positions defensively rather than continuing to carry risk it can no longer confirm the master account actually intends. MQL4 has no cross-terminal messaging mechanism, so the shared file is the entire channel. Both roles must be pointed at the same InpGroupName. A publisher instance and a follower instance running with different group names simply never see each other - the follower logs that plainly rather than mirroring nothing silently. Notes and limitations - ONE ROLE PER INSTANCE. This cannot publish and follow at the same time, and does not detect a misconfiguration where two accounts both think they are the publisher, or both think they are following each other - check InpRole on every instance by hand. - The published signal is NET exposure per symbol, not a ticket-for-ticket copy. A publisher account holding a matched hedge on one symbol (a buy and a sell open at once, netting close to zero) publishes that near-zero net figure, not the underlying hedge structure - a follower will not reproduce the hedge, only the net result. - Resync works by fully closing this EA's own tagged position on a symbol and reopening fresh, not by adjusting the existing ticket. Every resync pays the spread again; keep InpRecalcSeconds and InpMinAdjustLots reasonable to avoid unnecessary churn on a symbol whose signal is moving in small steps. - FILE_COMMON is shared per Windows user across every terminal installed for that user on this machine - it is not a network or internet mechanism. Publisher and followers must run on the same physical machine (or the same shared folder made visible another way) for this to work at all. - Scaling is a straight equity ratio. It does not independently verify that the follower's own rule limits (drawdown, daily loss) still permit the resulting size - InpMaxLotPerSymbol and InpMaxTotalLots are the only caps applied, and must be set correctly by the trader for each follower account. - New orders opened by the follower carry no stop-loss or take-profit of their own; risk management for the mirrored position is expected to come from the strategy being mirrored on the publisher side, or from a separate risk-management EA running alongside this one.

Expert advisor · MT5 · v1.0 · Free

About Funded Account Sync Shield

Funded Account Sync Shield is an expert advisor (trading robot) for MetaTrader 5. It can size trades from your balance and risk percent. It has 13 settings, such as Role, Group name and Magic number. MQL source code included.

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

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

Settings

SettingDefaultWhat it does
RoleSYNC_ROLE_FOLLOWPublish or Follow - set explicitly, never auto-detected
Group nameGroupAShared file identity - publisher and every follower must use the same name
Magic number234100Magic number for orders this EA (follower mode) opens and manages
Publish seconds15Publisher: minimum seconds between signal file writes
Recalc seconds20Follower: minimum seconds between resync checks
Max lot per symbol5.0Follower: hard cap on mirrored lot size for any one symbol
Max total lots20.0Follower: hard cap on the sum of mirrored lots across all symbols
Min adjust lots0.02Follower: minimum net-lot difference before bothering to resync a symbol
Max signal age seconds120Follower: signal older than this is treated as stale
Flatten on stale signaltrueFollower: close all mirrored positions if the signal goes stale
Divergence alert lots0.50Follower: alert if a single resync adjustment exceeds this many lots
Max retries5Trade retry attempts on a retryable error
Retry wait ms500Pause between retry attempts, in milliseconds

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: Risk & Lot Size · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria