Several EAs on one MetaTrader account: magic numbers, and how to see which EA earns the money
Many accounts do not run one Expert Advisor. They run three or four, plus a few trades by hand. That is reasonable: strategies that win at different times can smooth each other out. But it creates two practical problems. The EAs must not touch each other's trades, and after a few months you want to know which of them earns the money and which one gives it back. Both problems are solved by the same small thing: the magic number.
This post explains how to set magic numbers up so that nothing collides, what the EAs still share however clean the numbers are, and how to read the result per EA. The occasion: my free Magic Stats indicator is now also available for MetaTrader 4 (published on 17 November 2026).
What a magic number is

A magic number is a whole number that an EA attaches to every order it sends. It has no effect on the trade itself. Its only job is identification: when the EA looks at the open trades of the account, it picks out the ones that carry its own number and ignores the rest. Trades opened by hand, from the mobile app or by tools that set no magic carry the number 0.
Almost every EA has an input for it, usually called "Magic" or "Magic number". Most traders leave it at the default. With one EA that is fine. With several it is where the trouble starts.
Three mistakes that cause real damage
- Two different EAs with the same magic number. Each one believes the other's trades are its own. Depending on how they are written, one may trail, close or add to positions it never opened. If both also filter by symbol, the clash only shows when they trade the same symbol, which makes it harder to notice.
- The same EA on two charts with the same magic number. This is the common one. Two instances on EURUSD and GBPUSD are usually safe if the EA filters by symbol. Two instances on the same symbol with different settings are not: each instance counts the other's trades as its own, and a "one trade per day" rule or a grid step no longer means what you think.
- Changing the magic number while trades are open. The EA no longer recognises its open positions. They stay in the account without management: no trailing, no basket close, nothing. Change the number only when the EA is flat.
None of these produces an error message. The EAs simply behave differently from the backtest, and you find out later.
A numbering scheme that stays readable
Any scheme works as long as every instance has its own number and you can still read it in six months. A simple one is blocks:
| Block | Used for | Example |
|---|---|---|
| 1000-1999 | EA 1, one number per chart | 1001 = EURUSD, 1002 = GBPUSD |
| 2000-2999 | EA 2 | 2001 = XAUUSD |
| 3000-3999 | EA 3 | 3001 = DE40, 3002 = US500 |
| 0 | Manual trades | set by the terminal |
Two notes. Some EAs use more than one number internally, for example one per strategy or per slot, and count upwards from the number you enter. Read the description before you place the next EA directly above it. And write the list down, next to your set files.
What the EAs still share
Clean magic numbers separate the bookkeeping. They do not separate the risk. All EAs on one account share:
- Margin and stop out. If one EA builds a large basket, the free margin of every other EA shrinks. A stop out closes positions without asking which EA they belong to.
- Equity. A daily loss limit or an equity stop works on the whole account. One EA's bad day can end trading for all of them.
- Direction. Two EAs that are both long gold, or long two indices that fall together, are one position in practice. The magic numbers differ, the exposure adds up.
So before you add an EA, look at what it can hold at its worst moment together with the others, not at its own backtest alone.
Reading the result per EA

The terminal shows one balance for everything. To see each EA on its own you have to group the history by magic number. You can do that by hand in a spreadsheet, or let Magic Stats do it. It is an indicator, reads the history of the account and shows one row per magic number: trades, win %, net profit including swap and commission, profit factor, average trade, the maximum drawdown of the EA's closed-trade curve, the recovery factor, open orders and their floating result. There are tabs for today, week, month, year, all history and a custom start date, and a total row for the whole account. It never opens, changes or closes a trade.
The two platforms store history differently, and that matters for the counting:
| MetaTrader 5 | MetaTrader 4 | |
|---|---|---|
| History consists of | deals (fills), grouped by position | orders |
| Stop-loss / take-profit closes | closing deal often carries magic 0; the magic of the opening deal is used | the order keeps its magic number |
| Partial closes | one position, counted when the last part closes | rest continues under a new ticket ("from #..."); the pieces are joined into one trade |
| History available | always loaded from the account start | only what the Account History tab holds |
The last line is the one MT4 users trip over. An MT4 indicator only sees what the terminal's Account History tab shows. Open the Terminal window (Ctrl+T), go to Account History, right-click and choose All History. If the numbers look too small or the first trade is too recent, this is almost always the reason.
Names instead of numbers

A table full of numbers such as 1001 and 3002 is hard to read. One input takes a name map in the form 12345=TrendEA;777=IndexBot. Without it, a row takes the most frequent order comment of that EA, and if there is none it is shown as "Magic 12345". Magic 0 appears as "Manual".
What the table does not tell you
Please read a per-EA table with these limits in mind:
- Only closed trades count. An EA that holds its losers looks good until they close. In the example picture at the top, the row with the highest win rate (79.4 %) is the one with a negative net result. The numbers there are illustrative, but the pattern is common with grid systems.
- The drawdown is closed-trade drawdown. It is measured on the curve of closed trades and does not include the drawdown while a trade was open. The intra-trade drawdown can be much larger. The floating result has its own column; look at both.
- A partly closed trade appears when its last piece closes. Profit already realised by a partial close is not in the row before that.
- Few trades say little, and the past is not a forecast. A profit factor from 20 trades is noise. Compare EAs over the same period and with enough trades.
A routine that takes ten minutes a month
- Check that every EA instance has its own magic number and that the list is up to date.
- Open the MONTH and the ALL tab and sort by net profit, then by maximum drawdown.
- Look at the floating column for every EA with open trades, especially grid EAs.
- Decide what to do with an EA that is net negative over a meaningful number of trades: reduce it, move it to demo, or switch it off.
Magic Stats is free and fully working, with no time limit, on both platforms. As with every tool, please try it on a demo account first.
Magic Stats for MetaTrader 4: https://www.mql5.com/en/market/product/209319
Magic Stats for MetaTrader 5: https://www.mql5.com/en/market/product/200695
All my products in one overview: https://www.mql5.com/en/users/pablo1904/seller


