Master Silence Failsafe
If a master terminal crashes, loses its internet connection, or the VPS it runs on goes down outright, every slave copying it keeps whatever positions it last had open with no one steering them - and a copier setup with no silence detection at all has no way to notice this ever happened. Running on the master's chart in MASTER role, this EA writes a timestamp to a shared heartbeat file on a fixed interval. Running on the slave's chart in SLAVE role, it watches that file; the instant its embedded timestamp is older than InpGraceWindowSec, it closes every own-magic position on the slave account and keeps re-checking and re-flattening on every subsequent poll for as long as the master stays silent, so a repositioned or reopened trade during the outage does not quietly survive. Once the master's heartbeat is fresh again, the failsafe does not clear itself immediately - a heartbeat flickering back for one poll and then going stale again is not "recovered". It requires InpRecoveryConfirmSec of CONTINUOUS freshness before auto re-arming and returning to normal watching. This project assumes a silent master recovering on its own (reconnecting, restarting) is the common case worth handling automatically, unlike a manual-reset kill switch that always waits for a human - see the Slave Kill Chain Guard project elsewhere in this catalogue for that stricter, loss-burst-aware alternative. Notes and limitations - Reacts only to the master EA's own published heartbeat - if that EA is not attached and running, this looks identical to a genuine master outage and trips accordingly, which is the intended behaviour. - Auto-recovery is unconditional on heartbeat freshness alone; it does not check whether the master's underlying strategy or account is healthy in any other sense (see Slave Kill Chain Guard for a loss-burst and drawdown aware alternative if that distinction matters for a given pairing). - Two terminals must share the same machine's FILE_COMMON folder - this is local shared storage, not a network-synced mechanism, so a master and slave on physically separate machines need a different bridge for the heartbeat file. - While tripped, this EA only closes MARKET positions and cancels PENDING orders carrying the matched magic filter; it does not prevent a different EA on the slave from opening a brand-new position between polls - it will simply be flattened again on the next poll rather than blocked outright. - Reimplements its own order-flatten and heartbeat-file helpers inline rather than including another project's file, per this catalogue's no-cross-project-include rule.
Expert advisor · MT5 · v1.0 · Free
About Master Silence Failsafe
Master Silence Failsafe is an expert advisor (trading robot) for MetaTrader 5. It has 9 settings, such as Role, Instance tag and Master instance tag. MQL source code included.
Files in the download: MasterSilenceFailsafe.ex5, MasterSilenceFailsafe.mq5, MasterSilenceFailsafe.txt.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Role | ROLE_SLAVE | Which side of the copy relationship this chart plays |
| Instance tag | Shared filename tag for THIS master; blank = auto from account number (MASTER role only) | |
| Master instance tag | The MASTER's tag to watch (SLAVE role only) | |
| Heartbeat interval sec | 15 | MASTER: how often it rewrites its heartbeat file |
| Grace window sec | 60 | SLAVE: master heartbeat older than this trips the failsafe |
| Recovery confirm sec | 300 | SLAVE: master heartbeat must stay continuously fresh this long before auto re-arming |
| Magic filter | 0 | SLAVE: 0 = flatten every own position; otherwise only this magic number |
| Slippage points | 50 | SLAVE: slippage tolerance for the emergency flatten |
| Poll interval sec | 5 | Seconds between polls of the master's heartbeat / rescans of own positions |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Trade Copier · MT5 Expert Advisor · MQL5 Source Code