Session Gated Copier
A copier that fires the instant a signal arrives assumes the slave account should trade whenever the source trades. That is often wrong: a slave account might be restricted to a specific liquidity window, a specific desk's hours, or simply a trader's own rule about when that account is allowed to be in the market, independent of what the master is doing at 3am. This EA reads plain signal rows (id,symbol,type,lots) appended by an external source to a CSV file under MQL4\Files - the same file-bridge approach used elsewhere in this catalogue for signal relay, since MQL4 cannot open a socket to another terminal without a DLL. Each new signal is queued immediately. On every check, the EA evaluates its OWN up-to-three configured session windows (server time, with overnight-wrap support such as 22:00-02:00) and only executes queued signals while at least one window is open. A signal that arrives at 2am against an 08:00-16:00 slave window sits in the queue, unexecuted, until 08:00 - it is not discarded and not fired early. The queue and the last-processed signal id are persisted to a state file after every change, so a terminal restart while signals are queued resumes exactly where it left off rather than losing pending signals or re-processing ones already handled. Notes and limitations Session windows gate the SLAVE's own trading hours, not the master's - this EA has no visibility into when or why the master signalled, only into when this account is allowed to act on it. This EA only reads a signal file - it does not connect to another terminal and does not generate signals itself. A signal whose symbol is unknown to this terminal, or whose lot size normalises to zero under current broker limits at the moment a window opens, is logged and dropped rather than retried. Only market orders (BUY/SELL) are copied; the signal format has no pending-order concept, and no stop-loss/take-profit or trailing is attached after entry. Signal ids must increase monotonically in the source file; a row at or below the last processed id is silently ignored.
Expert advisor · MT5 · v1.0 · Free
About Session Gated Copier
Session Gated Copier is an expert advisor (trading robot) for MetaTrader 5. It has 8 settings, such as Signal file, Session1 and Session2. MQL source code included.
Files in the download: SessionGatedCopier.ex5, SessionGatedCopier.mq5, SessionGatedCopier.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 |
|---|---|---|
| Signal file | SessionGatedCopier_signals.csv | Source file under MQL5\Files, rows: id,symbol,type,lots |
| Session1 | 08:00-11:00 | Allowed window 1 (server time, HH:MM-HH:MM). Blank disables. |
| Session2 | 13:00-16:00 | Allowed window 2. Blank disables. |
| Session3 | Allowed window 3. Blank disables. | |
| Magic | 47400 | Magic number stamped on every copied order |
| Max queue size | 50 | Reject new signals once this many are pending |
| Max wait minutes | 0 | 0 = wait forever for a window; >0 = drop if no window opens within this long |
| Slippage pips | 3 | Slippage tolerance at execution time |
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: Buy/Sell Arrows · Trading Sessions · Trade Copier · MT5 Expert Advisor · MQL5 Source Code