рджреНрд╡рд╛рд░рд╛ William Harris ┬╖ рдЕрдВрддрд┐рдо рд╕рдореАрдХреНрд╖рд╛
How to Run Multiple Expert Advisors in MetaTrader 5
рдЖрдкрдХреЛ рдХреНрдпрд╛ рдЪрд╛рд╣рд┐рдП
- тАв MT5 terminal with sufficient RAM
- тАв Multiple EA .ex5 files in MQL5/Experts/
- тАв Spreadsheet to track Magic Numbers, risk per EA, and total exposure
рдЪрд░рдг-рджрд░-рдЪрд░рдг рдирд┐рд░реНрджреЗрд╢
рдЪрд░рдг 1: Plan a unique Magic Number per EA-chart pair
Magic Number is how each EA identifies its own trades in a shared terminal. The Magic is written into every order's MAGIC field, and the EA's order-management logic filters: 'show me only orders where MAGIC = my_magic'. If two EAs share a Magic, both think the other's positions are theirs and start closing them.
Plan Magic Numbers in advance. A reasonable scheme: EEEESS, where EEEE is an EA family ID (4 digits) and SS is a per-chart suffix (2 digits). Example: тАв MyEA #1234, EURUSD chart тЖТ Magic 123401 тАв MyEA #1234, GBPUSD chart тЖТ Magic 123402 тАв MyEA #1234, XAUUSD chart тЖТ Magic 123403 тАв OtherEA #5678, EURUSD chart тЖТ Magic 567801
Document the scheme in a spreadsheet. Every EA-chart attach gets a row: EA name, Magic, Symbol, Timeframe, Risk %, Active/Paused.
Most EAs let you override the Magic in the Common tab of the configuration popup (see attach-ea-chart guide). Override even if the EA has a 'good' default; never trust two different vendors to have picked non-overlapping defaults.
рдЪрд░рдг 2: Plan terminal resources
Each attached EA-chart costs RAM and CPU. Rough estimates for a typical retail EA:
тАв Idle MT5 terminal тАФ 300тАУ500 MB RAM тАв Each attached EA chart тАФ 300тАУ500 MB additional RAM тАв 1 year of M1 tick history per symbol тАФ 100тАУ200 MB additional RAM тАв Strategy Tester running in parallel тАФ 500тАУ2000 MB RAM
For a 5-EA setup across 5 charts on a single broker, expect 2.5тАУ4 GB sustained RAM. A 4 GB VPS chokes; 6тАУ8 GB is comfortable.
CPU is generally not a bottleneck for live trading тАФ EAs use single-digit % CPU when idle waiting for ticks. Optimization runs are the exception (each pass takes 100% of one core).
Monitor RAM usage in Windows Task Manager. If 'terminal.exe' uses >80% of available RAM consistently, you've over-subscribed; either upgrade the VPS or split EAs across multiple terminals.
For 15+ EAs, run multiple terminals (e.g. 3 terminals ├Ч 5 EAs each) so a hung EA in one terminal doesn't disrupt the others. Each terminal goes in its own folder with its own data folder.
рдЪрд░рдг 3: Allocate risk across the portfolio
Per-EA risk and account-level risk are different. If each of 5 EAs risks 1% per trade, your worst-case daily loss is 5%, not 1%, because all EAs can lose on the same day.
The right approach: тАв Decide your account-level max daily loss (e.g. 3%). тАв Estimate correlation between EAs. EAs that trade the same symbol, same direction, same timeframe are highly correlated (~80%). EAs that trade different symbols and strategies are moderately correlated (~30тАУ50%). Uncorrelated EAs (one trends, one mean-reverts) are ~10% correlated. тАв Compute per-EA risk: (Total Daily Risk) / (Number of EAs ├Ч correlation_multiplier). For 5 moderately-correlated EAs targeting 3% daily: 3% / (5 ├Ч 0.7) = ~0.85% per EA per day.
This is conservative тАФ in practice, EAs may not all trade on the same day, so realized daily loss is usually lower than the theoretical maximum. But size for the worst case; you can always size up later if the EA family shows uncorrelated performance over 6+ months.
Do not set all 5 EAs at 1% and hope for the best. The 'happy path' months feel great; the 'unhappy path' months wipe out three months of gains.
рдЪрд░рдг 4: Measure actual portfolio correlation
After 30 days of live trading, you can compute actual correlation between EAs from their realized P&L. The procedure:
1. Export each EA's daily P&L for the period (Account History тЖТ filter by Magic тЖТ daily aggregate in Excel). 2. Compute pairwise correlation (Excel CORREL function or pandas .corr()). 3. Update your risk budget if the actual correlation differs from estimated. Highly-correlated pairs (correlation > 0.7) should be treated as 'effectively one EA' for risk purposes.
Common surprises: тАв Two EAs from the same vendor often have 0.8+ correlation even on different symbols (shared signal logic). тАв Two trend-following EAs on different symbols often have 0.5+ correlation (same regime sensitivity). тАв A trend EA and a mean-reversion EA on the same symbol can have negative correlation (they win in opposite regimes) тАФ combining them reduces total drawdown.
This is the basis for portfolio construction. The goal isn't to maximize EA count; it's to maximize uncorrelated edges. 3 uncorrelated EAs at 1% each beat 10 correlated EAs at 0.3% each.
рдЪрд░рдг 5: Watch for order-management conflicts
Even with unique Magic Numbers, multi-EA setups can develop subtle conflicts:
тАв Symbol margin contention тАФ if 5 EAs all open EURUSD positions, total exposure can exceed broker margin limits. Margin Call triggers regardless of which EA caused it. Set per-EA max-position-size to leave headroom.
тАв Slippage cascade тАФ multiple EAs sending orders within milliseconds compete for the same liquidity. The second-arriving order may be filled at a worse price. For high-frequency EAs, stagger them or use different brokers.
тАв Stop-loss clustering тАФ if multiple EAs all use the same fixed stop distance, a single price spike can trigger all of them simultaneously, producing concentrated losses. Use varied stop logic.
тАв Daily-loss-limit collisions тАФ if you set a portfolio-level daily loss limit and it triggers, all EAs should be paused. A naive setup has each EA monitoring only its own loss, so the portfolio limit isn't enforced. Run a separate watchdog script (or a master EA) that monitors total equity and disables all EAs when the portfolio limit hits.
Most of these are operational issues that surface only in stress moments (news, weekend gaps). Run a 30-day demo of the multi-EA portfolio before going live to surface them.
рдЪрд░рдг 6: Set up multi-EA monitoring
Single-EA monitoring (covered in setup-vps-mt5 guide) doesn't scale to 5+ EAs. Build a dashboard:
Minimum viable monitoring: тАв Daily email of per-EA P&L, broken down by Magic Number. тАв MT5 mobile app notifications for any closed position. тАв External uptime ping on the VPS.
Better monitoring: тАв A Python script using the MetaTrader5 API to pull positions/history every minute, aggregate by Magic, and post to a dashboard (Grafana, Notion, Google Sheet). тАв Alerts on per-EA drawdown exceeding a threshold (e.g. 'EA Magic 123401 drawdown > 3% тАФ investigate'). тАв Weekly P&L report by EA with comparison to backtest expectation.
Best: тАв A master EA running in its own MT5 instance that monitors all other EAs across the portfolio, disables EAs hitting drawdown thresholds, and posts status to Telegram/Slack in real-time. тАв Daily reconciliation against an independent data source (broker's web portal P&L vs MT5 reported P&L) to catch silent data corruption.
The operational cost of monitoring scales with EA count. Budget 30 minutes per day per 5 EAs for review during the first 90 days of any multi-EA portfolio.
рдмрдЪрдиреЗ рдХреЗ рд▓рд┐рдП рд╕рд╛рдорд╛рдиреНрдп рдЧрд▓рддрд┐рдпрд╛рдБ
- тЬЧ Sharing Magic Numbers between EAsрдареАрдХ рдХрд░реЗрдВ: Strictly unique per EA-chart pair. Document in a spreadsheet.
- тЬЧ Setting 1% risk per EA ├Ч 10 EAs and expecting 1% daily lossрдареАрдХ рдХрд░реЗрдВ: Worst case is 10% daily loss. Size down per-EA to keep portfolio total under your account-level limit.
- тЬЧ Running 15 EAs on a 4 GB VPSрдареАрдХ рдХрд░реЗрдВ: Upgrade to 16 GB RAM or split across multiple terminals. RAM exhaustion causes MT5 to drop ticks silently.
- тЬЧ No portfolio-level monitoring тАФ each EA monitors only itselfрдареАрдХ рдХрд░реЗрдВ: Run an external watchdog that aggregates across all EAs and enforces account-level limits.
- тЬЧ Assuming low correlation without measurementрдареАрдХ рдХрд░реЗрдВ: After 30 days, compute actual correlation matrix. Often higher than expected.
рдЕрдХреНрд╕рд░ рдкреВрдЫреЗ рдЬрд╛рдиреЗ рд╡рд╛рд▓реЗ рдкреНрд░рд╢реНрди
How many EAs can I run on one MT5 terminal?
The MetaTrader 5 engine handles many EAs well тАФ there's no hard architectural cap. The bottleneck is usually system resources (RAM and disk I/O for tick history) and operational complexity (managing 15+ unique Magic Numbers, monitoring 15+ EAs). Most professional setups split across multiple terminals for failure isolation: if one terminal hangs, the EAs in other terminals keep running.
Should I split EAs across multiple brokers?
Above ┬г85k FCA / $250k AUD ASIC, multi-broker is essentially mandatory because single-broker insolvency is no longer fully insured. Below those thresholds, single-broker is fine unless you have a specific reason (one EA works better on broker A, another on broker B). Multi-broker setups need separate VPS terminals per broker.
Does the order EAs initialise affect anything?
If you have a master/slave setup (one EA generates signals, others execute), the signal EA must initialise first. MT5 doesn't guarantee initialisation order across charts, so the slave EAs should poll for the master's existence in OnTick and wait if not ready. Vendor docs for orchestration-style EAs cover this; most retail EAs are standalone.
Two EAs trade EURUSD on different timeframes. Will they conflict?
MT5 doesn't enforce 'one symbol, one EA' тАФ multiple EAs can trade EURUSD simultaneously, just with different Magics. The implementation works; the risk is conceptual. Treat them as one effective position from a risk-budgeting perspective even though they're technically two EAs.
Can multiple EAs read from the same data file?
Shared-file architectures are common for signal-broadcast setups: a signal-generation EA writes the latest forecast to a CSV, and N execution EAs (each on a different symbol/broker) read the CSV. Use the FileOpen flag FILE_SHARE_READ to allow concurrent reads, and FILE_SHARE_WRITE only on the writer side. Race conditions are rare in practice if writes are infrequent (e.g. once per minute) and writers use atomic-rename semantics.
Can MT5 Strategy Tester backtest multiple EAs together?
The lack of multi-EA backtesting is a real limitation. Single-EA backtests can't capture portfolio effects: shared margin, correlation-driven drawdown clustering, or slippage cascades. Serious portfolio research uses Python (MetaTrader5 package or custom tick replay) for full multi-EA simulation. For 80% of retail use cases, running each EA separately and combining trade lists in a spreadsheet is sufficient.
Multi-EA setup complete тАФ monitor it
When one of N EAs stops trading, you need to know which one and why. Our troubleshooting guide walks through the diagnostic flow.
Continue to: Why is my EA not trading? тЖТрд╕рдВрдмрдВрдзрд┐рдд рдЧрд╛рдЗрдб

William Harris
FxRobotEasy рдХреЗ рд╕рдВрд╕реНрдерд╛рдкрдХ рдФрд░ рд▓реАрдб рдбреЗрд╡рд▓рдкрд░
рд╢рд┐рдХрд╛рдЧреЛ, USA ┬╖ 2021 рд╕реЗ
- 12+ рд╕рд╛рд▓ рд▓рд╛рдЗрд╡ рдЯреНрд░реЗрдбрд┐рдВрдЧ
- 10+ рд╕рд╛рд▓ MQL5 / MQL4
- 3 рд▓рд╛рдЗрд╡-рд╕рддреНрдпрд╛рдкрд┐рдд Expert Advisors
- 2021 рдореЗрдВ рд╕реНрдерд╛рдкрд┐рдд
тАЬрдореИрдВ рдордзреНрдп рд╡рд┐рджреНрдпрд╛рд▓рдп рд╕реЗ рдХреЛрдб рдХреЗ рд╕рд╛рде рдЪреАрдЬреЗрдВ рдмрдирд╛ рд░рд╣рд╛ рд╣реВрдБред рдореИрдВ рд╡рд┐рд╢реНрд╡рд╡рд┐рджреНрдпрд╛рд▓рдп рд╕реЗ рдЯреНрд░реЗрдб рдХрд░ рд░рд╣рд╛ рд╣реВрдБред рдЙрди рджреЛ рджреБрдирд┐рдпрд╛рдУрдВ рдХрд╛ рдЪреМрд░рд╛рд╣рд╛ тАФ рдПрд▓реНрдЧреЛрд░рд┐рдердо, рдмрд╛рдЬрд╝рд╛рд░, рдФрд░ рдЙрдиреНрд╣реЗрдВ рдЬреЛрдбрд╝рдиреЗ рд╡рд╛рд▓реА рдкреНрд░реМрджреНрдпреЛрдЧрд┐рдХреА тАФ рд╡рд╣ рдЬрдЧрд╣ рд╣реИ рдЬрд╣рд╛рдБ рдореИрдВрдиреЗ рдкрд┐рдЫрд▓реЗ рдкрдВрджреНрд░рд╣ рд╡рд░реНрд╖ рдмрд┐рддрд╛рдП рд╣реИрдВред FxRobotEasy рддрдм рд╣реЛрддрд╛ рд╣реИ рдЬрдм рдЖрдк рддрдм рддрдХ рд░реБрдХрдиреЗ рд╕реЗ рдЗрдирдХрд╛рд░ рдХрд░рддреЗ рд╣реИрдВ рдЬрдм рддрдХ рдЖрдкрдиреЗ рдЬреЛ рдХрд▓реНрдкрдирд╛ рдХреА рд╡рд╣ рд╡рд╛рд╕реНрддрд╡ рдореЗрдВ рд▓рд╛рдЗрд╡ рдмреНрд░реЛрдХрд░ рдЦрд╛рддреЗ рдкрд░ рдХрд╛рдо рди рдХрд░реЗредтАЭ