Loading…

Delayed Mirror Buffer

Copy-trading setups usually aim for the shortest possible gap between a source signal and the copy firing. Some situations need the opposite: a compliance policy that requires a mandatory minimum interval before a signal from one source can be acted on elsewhere, or a researcher who wants to isolate exactly how much a copy strategy's results degrade purely from execution latency, independent of any other difference between the source and the copy. This EA does not connect to another terminal directly - MQL4 has no built-in way to do that without a DLL, which this catalogue avoids outright. Instead it reads a plain CSV file under MQL4\Files that some external process (a script, another EA writing to the shared file, a bridge you control) appends new signal rows to, in the form id,symbol,type,lots. Every new row is placed in an internal queue with a release time set to the moment it was seen plus the configured delay. Nothing about a queued signal is acted on until that release time arrives, at which point the order is sent with full broker-limit revalidation (lot normalisation, symbol tradability) at execution time rather than at the moment the signal first arrived. The queue and the last-processed signal id are written to a state file after every change. A terminal restart mid-delay resumes the exact same pending queue with its original release times intact - a delay that could be defeated just by restarting the terminal would not be a real delay for compliance purposes. Notes and limitations This EA only reads a file - it does not generate signals itself and does not connect to another terminal or broker. Producing InpSignalFile is entirely the operator's responsibility. A signal whose symbol is not known to this terminal, or whose lot size normalises to zero under current broker limits at release time, is logged and dropped rather than retried - the design intent is an honest delayed mirror, not a best-effort retry loop that could blur exactly when an order was actually sent. Only market orders (BUY/SELL) are mirrored; the signal format has no pending-order concept. Signal ids must increase monotonically in the source file - a row with an id at or below the last processed id is silently ignored, which also means restarting the external source's id counter would stop new signals from being picked up. This EA never manages a position after mirroring it - no stop-loss/take-profit is attached and no trailing occurs.

Expert advisor · MT5 · v1.0 · Free

About Delayed Mirror Buffer

Delayed Mirror Buffer is an expert advisor (trading robot) for MetaTrader 5. It has 5 settings, such as Signal file, Delay seconds and Magic. MQL source code included.

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

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

Settings

SettingDefaultWhat it does
Signal fileDelayedMirrorBuffer_signals.csvSource file under MQL5\Files, rows: id,symbol,type,lots
Delay seconds300Delay applied to every queued signal before it is mirrored
Magic45800Magic number stamped on every mirrored order
Max queue size50Reject new signals once this many are pending
Slippage pips3Slippage tolerance at mirrored-execution time

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: Buy/Sell Arrows · Trade Copier · Arbitrage · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria