Von William Harris · Zuletzt geprüft
How to Run Multiple Expert Advisors in MetaTrader 5
Was Sie benötigen
- • MT5 terminal with sufficient RAM
- • Multiple EA .ex5 files in MQL5/Experts/
- • Spreadsheet to track Magic Numbers, risk per EA, and total exposure
Schritt-für-Schritt-Anleitung
Schritt 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.
Schritt 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.
Schritt 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.
Schritt 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.
Schritt 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.
Schritt 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.
Häufige Fehler vermeiden
- ✗ Sharing Magic Numbers between EAsLösung: Strictly unique per EA-chart pair. Document in a spreadsheet.
- ✗ Setting 1% risk per EA × 10 EAs and expecting 1% daily lossLösung: 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 VPSLösung: 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 itselfLösung: Run an external watchdog that aggregates across all EAs and enforces account-level limits.
- ✗ Assuming low correlation without measurementLösung: After 30 days, compute actual correlation matrix. Often higher than expected.
Häufig gestellte Fragen
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? →Verwandte Anleitungen

William Harris
Gründer & Lead Developer von FxRobotEasy
Chicago, USA · Seit 2021
- 12+ Jahre Live-Trading
- 10+ Jahre MQL5 / MQL4
- 3 live-verifizierte Expert Advisors
- Gegründet 2021
“Ich entwickle Software seit der Mittelschule. Ich handle seit dem Studium. Die Schnittstelle dieser beiden Welten — Algorithmen, Märkte und die Technologie, die sie verbindet — ist der Ort, an dem ich die letzten fünfzehn Jahre verbracht habe. FxRobotEasy ist das, was entsteht, wenn man sich weigert aufzuhören, bis das, was man sich vorgestellt hat, tatsächlich auf einem Live-Broker-Konto funktioniert.”