Loading…

Filtering Copier

A plain copier treats every signal as automatically valid for the slave account, which is rarely true in practice: the slave may not want to trade every symbol the master does, may only be allowed to trade during certain hours, or may need a hard cap on position size and margin use that has nothing to do with what the master account itself can afford. This copier puts those three checks - symbol, session, risk - between the signal and the order, and none of them silently swallow a rejected signal. Every decline is appended to a CSV log with a timestamp, the symbol, the direction, the lots, and a specific human-readable reason, because a copier that quietly skips trades is indistinguishable from one that has stopped working, and the log is what tells the difference. The risk check itself never assumes a contract size or margin rate. It reads the broker's own per-symbol MODE_MARGINREQUIRED for the projected total-margin-as-percent-of-equity comparison, and separately calls AccountFreeMarginCheck - a genuine broker-side projection, not an approximation - to catch any trade the broker itself would reject for insufficient margin, even one that passes the percent-of-equity check on paper. Notes and limitations - This EA does not write the signal file itself - it only reads one. Producing that file on the master side is outside this project's scope. - Only the LAST unread line in the signal file is acted on each poll; earlier unread lines are treated as superseded, not queued and replayed one by one. - A stale signal (older than InpMaxSignalAgeSec) never reaches the filters at all and is not written to the decline log - staleness is a transport problem, not a filtering decision. - A signal for a symbol this account already holds a position on (own magic) is treated as an already-satisfied no-op, not a decline. - The risk check's percent-of-equity projection uses the broker's own MODE_MARGINREQUIRED figure; on a symbol where that figure is unavailable or zero, the projection falls back to the AccountFreeMarginCheck hard check alone rather than blocking blindly.

Expert advisor · MT5 · v1.0 · Free

About Filtering Copier

Filtering Copier is an expert advisor (trading robot) for MetaTrader 5. It trades only in the hours you set (time filter), can size trades from your balance and risk percent and is set up for gold (XAUUSD). It has 11 settings, such as Signal file name, Decline log name and Allowed symbols. MQL source code included.

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

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

Settings

SettingDefaultWhat it does
Signal file namefiltering_copier_signal.csvFile in MQL5\Files\ written by the master/bridge
Decline log namefiltering_copier_declines.csvFile in MQL5\Files\ - every declined signal, with reason
Allowed symbolsEURUSD,GBPUSD,USDJPY,XAUUSDComma separated symbol allow-list ("ANY" = no symbol filter)
Session start hour7Allowed trading window start, broker server hour (0-23)
Session end hour20Allowed trading window end, broker server hour (0-23), exclusive
Max lots per trade1.0Reject any single signalled lot size above this
Max total risk pct10.0Reject a new trade if it would push total margin used above this % of equity
Magic number46500Magic number stamped on orders this EA opens
Slippage points30Maximum acceptable slippage, in points
Max signal age sec90Ignore a signal older than this many seconds
Poll interval sec2Seconds between checks of the signal file

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 · Trading Sessions · Risk & Lot Size · Trade Copier · Time Filter · Gold (XAUUSD) · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria