Loading…

Copier Conflict Referee

Running several copiers side by side on one slave account, one per master, works fine right up until two masters disagree about the same symbol at the same time - one says BUY, another says SELL, or a lower-ranked source's signal arrives after a higher-ranked source already opened a position. Left to ordinary polling, whichever file this EA happens to read last simply wins, which is an accident of timing, not a decision anyone made. This EA gives every configured source its own magic number, so at any moment it can look at an open position on a symbol and know exactly which source currently owns it. When a fresh signal arrives from a DIFFERENT source than the current owner, the referee compares configured priorities (lower number means higher priority): a strictly higher-priority source closes the existing owner's position and takes over, a lower-or-equal-priority source is declined and logged, and the existing owner's position is left completely untouched. A source can only flatten its own positions with a FLAT signal - it has no authority to flatten another source's holding just because it went flat itself. Every ruling - override, decline, or a source simply opening on a symbol nobody currently holds - is written to the Experts log with both sources' names and priorities, so a review of the log always explains why the slave account ended up holding what it holds. Notes and limitations - This EA does not write any source's signal file - it only reads them. Producing each source's file is outside this project's scope and must be built separately, one per master. - Up to 20 sources can be configured (a fixed-size cap, chosen for simple, safe array handling in native MQL4 rather than dynamic growth); a 21st entry in InpSourceConfig is dropped with a log line. - Priority is a strict override rule: a source only takes over a symbol from another source if its priority number is strictly lower. Equal priorities are treated as "no override" in both directions - the existing owner keeps the symbol either way, so duplicate priority numbers in InpSourceConfig effectively make whichever source opened first permanent until it goes FLAT itself. - Ownership is tracked purely by magic number on open orders. A manually opened position, or one opened by any EA outside this configured source list, is invisible to the referee entirely - it neither blocks nor is protected by the priority rules. - This EA does not resize signals to this account's own risk. It normalises the signalled lot size to this broker's own step/min/max and opens exactly that, scaled by nothing else.

Expert advisor · MT4 · v1.0 · Free

About Copier Conflict Referee

Copier Conflict Referee is an expert advisor (trading robot) for MetaTrader 4. It has 4 settings, such as Base magic, Slippage points and Max signal age sec. MQL source code included.

Files in the download: CopierConflictReferee.ex4, CopierConflictReferee.mq4, CopierConflictReferee.txt.

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

Settings

SettingDefaultWhat it does
Base magic46700Each source gets InpBaseMagic + its index as its own magic number
Slippage points30Maximum acceptable slippage, in points
Max signal age sec90Ignore a signal older than this many seconds
Poll interval sec2Seconds between checks of every source's signal file

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 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 · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria