Loading…

Multi Challenge Orchestrator

Running several challenge accounts side by side - each in its own terminal - means a trader can lose track of the group's combined risk even while each individual account still looks fine on its own. One MQL4 program only ever runs inside its own terminal; it has no way to read another terminal's account state directly, since MQL4 has no inter-process API for that. This EA works around that limit the only way MQL4 genuinely allows: every attached instance writes its own account's status - balance baseline, current equity, pause state - to ONE shared file in the Common\Files folder (visible to every terminal on the machine, independent of which terminal data folder each account lives in), and reads every other instance's latest row from that same file on every check. Each instance then decides for ITSELF whether the group's combined loss has reached the configured threshold and, if so, pauses and flattens ITS OWN account only - it cannot reach across and flatten another terminal directly. Because every instance in the group runs the same rule against the same shared file, the group converges on a coordinated outcome even though each program only ever acts on its own account: once the shared math says the threshold is breached, every instance that reads the file after that point reaches the same conclusion and pauses itself in turn. Concurrent writes from several terminals to the same file are a real hazard with no true locking available in MQL4 file I/O. This is handled by keeping the file open for the shortest possible time per write and by simply trying again next cycle if a read or write does not go as expected, rather than attempting to build any locking scheme - a torn read is possible and is treated as "try again next cycle", not as a hard failure. Notes and limitations - This EA never touches another terminal's positions. It only ever acts on the account it is attached to. Group-wide flattening is an emergent result of every instance reaching the same conclusion independently, not a command sent from one instance to another. - All accounts in a group must be reachable from the same Windows user's Common\Files folder - accounts on different machines cannot coordinate through this mechanism. - A brand-new group member's first published row is what makes it count toward the group total; until its first successful write, the other instances do not know it exists. - Flattening requires AutoTrading to be enabled on that account's terminal; if it is off when the group threshold is breached, that instance alerts loudly but cannot act, and says so.

Expert advisor · MT5 · v1.0 · Free

About Multi Challenge Orchestrator

Multi Challenge Orchestrator is an expert advisor (trading robot) for MetaTrader 5. It can size trades from your balance and risk percent. It has 11 settings, such as Group id, Shared file name and Max group loss percent. MQL source code included.

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

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

Settings

SettingDefaultWhat it does
Group idPropGroup1Label identifying this group of accounts - only instances sharing this label coordinate together
Shared file nameMultiChallengeOrchestrator_Group.csvShared (Common\Files) file every instance in the group reads and writes
Max group loss percent6.0If the group's combined daily loss (as % of combined starting balance) reaches this, THIS account pa
Stale entry seconds120Another account's row older than this is ignored as offline, not counted in the group total
Flatten on breachtrueClose this account's own open orders when the group threshold is breached
Auto reset next daytrueClear this account's own pause automatically at the next daily rollover
Manual reset requestfalseSet true and re-attach (or update inputs) to clear this account's pause immediately
Dry runfalsetrue = alert only when breached, never actually flattens
Timer interval sec20How often this account publishes its status and re-checks the group
Max retries5Attempts per order action before giving up
Retry wait ms500Pause between attempts, milliseconds

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: Risk & Lot Size · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria