Can you run multiple Expert Advisors on one account? Magic numbers explained
By Benjamin Lee · Published 2026-10-11 · Updated 2026-10-30 · 3 min read
Yes, you can run several Expert Advisors on one MT5 account by attaching each to its own chart, as long as every EA uses a different magic number and you size them for their combined margin and risk. They share one balance and one pool of free margin, so a problem with one affects the others. On a netting account, two EAs on the same symbol share a single position, and magic numbers cannot keep them apart.
One EA per chart: how to run two Expert Advisors in MT5
In MT5 each EA is attached to its own chart. To run two EAs you open two charts, even if they trade the same symbol, and attach one EA to each. A single chart can hold only one EA at a time.
The Algo Trading button in the toolbar is global, but the Allow Algo Trading tick on each EA's Common tab is per chart, so confirm both. An EA that trades several symbols from one chart still counts as one EA, so it needs one chart and one magic number.
What is a magic number in MT5?
The magic number is an ID an EA stamps on every order it places. The EA uses it to recognise its own trades and leave other trades alone. Two copies of the same EA on one account must have different magic numbers, or they can manage each other's positions.
Trades you open by hand carry a magic number of 0. An EA that is set to manage every position on the symbol regardless of magic number can therefore modify or close your manual trades, so read the manual to see how the EA filters positions.
How to set up several EAs safely, step by step
This routine keeps each EA's trades separate and lets you check later which EA opened which trade.
- Open one chart per EA and symbol, and set the timeframe each EA expects.
- Attach the first EA and note the Magic Number on its Inputs tab.
- Attach the second EA and give it a different value. If it is a second copy of the same EA, you must change it.
- Tick Allow Algo Trading on each chart and check the smiley face in the corner.
- Open the Trade tab and the History tab and confirm each trade's comment or magic number matches the EA you expect.
Hedging versus netting accounts
On a hedging account each EA keeps its own positions, while on a netting account trades on the same symbol are merged into one position, so two EAs on the same symbol can interfere with each other. Check your account type before running several EAs on one symbol.
If you are unsure, your broker can tell you which type the account is. On netting accounts, an EA that buys while another sells the same symbol can reduce or close the other's position, and the magic number cannot separate them because there is only one position.
Margin and combined risk: a worked example
Every EA on one account draws on the same free margin, and their drawdowns can overlap, so each one needs sizing against the combined exposure of all of them.
An illustrative calculation: with 1:100 leverage, one standard lot of EURUSD at 1.1000 needs about 1,100 USD of margin. Three EAs each holding 0.50 lot at the same time use 1.50 lots, or about 1,650 USD, even though each looks small on its own. If their stop losses are each set to risk 1% of the balance and all three trade USD pairs that move together, a single USD move can hit all three stops, a combined 3% loss in one event.
Common problems when running multiple EAs
Check for these whenever two or more EAs share an account.
- Duplicate magic numbers, so one EA closes or modifies the other's trades.
- Several EAs trading correlated symbols, which stack the same risk.
- Total margin use near the limit, so new orders are rejected with a not enough money message.
- Too many charts on a small computer or VPS, slowing the terminal and delaying execution.
- Changing one EA's settings and forgetting that the chart reloads that EA with open trades.
Frequently asked questions
Do I need a different magic number for each EA?
Different EAs usually have their own default magic numbers, but two copies of the same EA must be given different ones.
How many Expert Advisors can I run on one MT5 account?
The platform sets no fixed EA count. The practical limits are one EA per chart, your free margin, your computer or VPS resources, and any limit your broker places on open orders. Add EAs one at a time and watch the terminal.
What happens if two EAs have the same magic number?
Both see the same positions as their own. One can close, modify or count the other's trades, which breaks logic such as maximum open trades. Give each EA a unique number in its Inputs tab.
Can I run the same EA on several symbols?
Yes, by attaching it to one chart per symbol, each with a different magic number unless the manual says otherwise. Check combined risk, as several symbols can move together.
Can two EAs trade the same symbol?
Yes on a hedging account, with different magic numbers. On a netting account positions merge, so avoid it.
Where do I set the magic number?
In the EA's Inputs tab when you attach it. The input is usually called Magic Number or MagicNumber.
Sources and further reading
- MQL5 Reference: Trade Request StructureThe magic field an Expert Advisor uses to tag its own orders.
- MetaTrader 5 Help: Basic Principles of Trading OperationsOrders, deals and positions, and how netting and hedging accounts differ.
Trading foreign exchange, gold and CFDs carries a high level of risk and may not be suitable for all investors. Past performance, backtests and live results do not guarantee future returns. This guide is general education, not financial advice.
More on installing and fixing MT5 Expert Advisors
- Start here: How to install an Expert Advisor (EA) on MetaTrader 5
- How to Install and Run an Expert Advisor on MT5: A Safe, Step-by-Step Guide
- MT5 EA not trading: AutoTrading disabled and error 4752, 10026, 10027
- MT5 Expert Advisor Not Showing in Navigator: Eight Checks in Order, With a Decision Table
- MT5 Trade Return Codes Explained: What 10004, 10014, 10016, 10019, 10027 and 10030 Mean and How to Fix Them
- MT5 Invalid Stops (10016) and Invalid Volume (10014) Errors: Why Your EA's Orders Are Refused and How to Fix Them
- MT5 Order Filling Modes Explained: FOK, IOC and Return, and How to Fix an Invalid Fill Error
More guides
- How to choose a forex broker for an Expert Advisor
- What is a forex Expert Advisor (EA)? A plain-English guide
- MT4 vs MT5 for Expert Advisors: which should you use?
- How to forward-test an Expert Advisor on a demo account
- How to read an MT5 Strategy Tester report
- MT5 Expert Advisors: the complete guide
- How to install an Expert Advisor (EA) on MetaTrader 5