Which of your EAs actually makes money? Statistics by magic number in MT5
If you run more than one Expert Advisor on an account, the balance only tells you the sum. One EA can carry the account while another slowly gives the money back, and the balance curve won't show you which is which. MetaTrader 5 has the data, because every deal carries the magic number of the EA that placed it. It just doesn't add it up per EA.
That is what Magic Stats does. It is a free indicator that reads your deal history and shows one row per magic number: trades, win rate, net profit, profit factor, drawdown, recovery factor, open positions and a small equity line. This post explains how to set it up, how to read the numbers, and where their limits are.
Product page: Expert Advisor Statistics by Magic Number
1. Setup in two minutes
- Install Magic Stats from the Market. It appears under Indicators.
- Drag it onto any chart. Symbol and timeframe don't matter, and it can share the chart with an EA. Magic Stats never trades.
- On the first start it reads the whole account history in slices of 2,000 deals. The status box shows the progress, then the table appears.
- Important on a new terminal: Magic Stats can only see what the terminal has downloaded. Open Toolbox → History, right-click and choose All history once. The new deals show up in Magic Stats within one refresh (10 seconds by default).
That's all. The remaining inputs are optional: a name map (see section 3), a split by symbol, the panel position, the number of visible rows, the start tab and sort column, and the decimal separator for the CSV export.
2. Reading the panel
The tabs at the top choose the period: TODAY, WEEK (from Monday 00:00), MONTH, YEAR, ALL and CUSTOM (from a date you set). All periods use the broker's server time. A trade belongs to the period of its final close, even if it was opened earlier.
Click a column header (Trades, Win %, Net, PF, Max DD) to sort; click it again to reverse the order. The line under the status box tells you exactly what is counted, for example "This year since 2026.01.01 (server time) · trades counted at their final close · values in USD".
Where the numbers come from
MetaTrader stores deals (fills), not trades. Magic Stats groups the deals by position id and turns every position into one trade:
- The magic number is taken from the opening deal. This matters, because closes by stop loss, take profit or stop-out often carry magic 0. If the closing deal decided, an EA's losing trades would end up under "Manual".
- The result of a trade is profit + swap + commission + fee of all its deals: the entry, any additions, every partial close and the final close.
- A position closed in several steps is one trade, counted when the last part closes.
- Deposits, withdrawals, credit and other balance operations are ignored. Cost deals without a position are shown on a separate "Unattributed costs" line, so they don't distort any EA's row.
The metrics, one by one
- Win % = winning trades / all trades. A trade with a result of exactly 0.00 is neither a win nor a loss, but it counts as a trade.
- Net = the sum of all trade results, costs included.
- PF (profit factor) = gross profit / gross loss. Above 1.0 the EA made money in this period; below 1.0 it lost. Magic Stats colours PF green from 1.5 and red below 1.0. With no losing trade at all the PF is infinite and shown as "—".
- Avg trade = Net / Trades. Compare it with your typical spread and commission: an EA that earns little more than its costs per trade is fragile.
- Max DD = the largest fall of the EA's closed-trade equity curve, in money. The curve starts at 0 at the beginning of the period, so if the first trade of the period loses 40, Max DD is already 40.
- RF (recovery factor) = Net / Max DD. An RF of 3 means the EA earned three times its worst closed-trade drawdown in that period. RF usually grows with the length of the period, so compare EAs on the same tab.
- Open and Floating = positions of this magic that are open right now and their profit + swap. Commission (entry and exit) is not included; it is added to the trade when it closes. These two columns ignore the period.
Win rate is not profit. In the example account in the screenshots, the grid EA has by far the highest win rate (79.4 % over 243 trades) and is the only EA that lost money overall (PF 0.93, net −195.90). Sort by PF and it drops to the bottom. Many small wins and a few large losses produce exactly that picture.
Why closed-trade drawdown? Magic Stats rebuilds the past from deals, and the deal history does not record how deep an open trade went against you. So Max DD only uses closed results, and the coverage line under the table says so: "closed-trade DD (excludes floating)". An EA that holds losers for a long time (grids, martingales, no stop loss) can have a much deeper real drawdown than this number. For those EAs, look at the Floating column as well.
Total row. The total account row merges all trades of the period into one curve. Its Max DD is usually smaller than the sum of the rows' drawdowns, because one EA's losses often fall on days when another EA wins. In the example, the rows add up to 3,500.33 of drawdown, while the account as a whole had 967.73.
3. Give your EAs names
By default a row is named after the most frequent comment of that EA's opening deals, otherwise "Magic 12345". Magic 0 is "Manual". If your EAs write cryptic comments, or none, use the Names input:
12345=TrendEA;777=IndexBot;0=My hand trades
Entries are separated by ; and each one is magic=name. Spaces around the parts are ignored. An entry that can't be read is skipped, and if a magic appears twice, the last entry wins. Note that two EAs using the same magic number end up in the same row. Magic Stats can only separate what the magic numbers separate, so give every EA instance its own magic.
4. CSV in Excel: dot or comma
EXPORT CSV writes the current tab, in the current sort order, to MQL5\Files\MagicStats_<account>_<period>.csv (File → Open Data Folder in MetaTrader). The first line describes the export (account, period, start, coverage line, currency), the second is the header, then one line per row, a final ALL line for the total (and an UNATTRIBUTED line if there are such costs). Gross profit, gross loss, wins and losses are included as extra columns.
- The field separator is always a semicolon. There are no thousands separators.
- European Excel (German, French, Italian ... regional settings): set the input CSV decimal separator to , (comma). The file then opens correctly with a double-click.
- US/UK Excel: keep . (dot) and open the file with Data → From Text/CSV, delimiter Semicolon. A plain double-click would put each line into one cell, because Excel expects a comma there.
- LibreOffice asks for the separator when it opens the file: tick Semicolon.
- ProfitFactor and RecoveryFactor are inf when they are infinite (no losing trade, or no drawdown with a profit) and empty when they are undefined (no trades).
- If the file is still open in Excel, Windows blocks the new export. The status box tells you; close the file and click again.
5. FAQ
My EA's trades show up under "Manual". Why?
Magic Stats takes the magic from the opening deal. If the EA opens its trades with magic 0, they are manual trades as far as MetaTrader knows. Check the EA's magic number input.
Magic Stats shows fewer trades than the History tab.
The History tab lists deals; Magic Stats counts positions. A trade with two partial closes is three deals but one trade. Also make sure the terminal has the full history (Toolbox → History → All history).
A partial close isn't in the table yet.
That is by design. The trade is counted when the position is fully closed, with every part included.
Why is Max DD smaller than the drawdown in my Strategy Tester report?
The tester report also shows equity drawdown, which includes open trades. Magic Stats measures closed-trade drawdown from the deal history. Both are correct; they measure different things.
Does it work on netting accounts?
Yes. A reversal (one deal that flips the position) closes one trade and opens the next; the commission and fee of that deal are split between the two by volume. If several magics trade the same netting position, that trade is shown as "Mixed (netting)".
Can I use it in the Strategy Tester?
It runs there, but it only sees the tester's own deals. It is made for live and demo accounts.
Does it send my data anywhere?
No. It has no internet functions and no DLL. The only file it writes is the CSV, when you click the button.
Does it slow down my EAs?
The first load is done in small slices so the chart stays responsive. After that it only processes new deals, by default every 10 seconds, re-checks the deals already read in small batches (a full pass about every 10 minutes), and only redraws the panel when a value has changed.
Can I run two Magic Stats instances on one chart?
Yes. Each instance gets its own number ("Magic Stats #2" …) and its own chart objects. Give each one a different Panel X / Panel Y, otherwise they are drawn on top of each other.
Is there a time limit?
No. Magic Stats is free and fully working, with no trial period and no nag screens.
6. How it was tested
Before release (9 October 2026, RoboForex demo, final build after an external code review by three AI models from other providers): the built-in self-test passed 164 of 164 checks in the indicator tester with no error lines. On a live demo account with 8 EAs and 9,316 closed trades the totals reconcile, and the CSV export and the period tabs were checked.
7. Next step: compare with independent results
Magic Stats shows how EAs performed on your account. If you are choosing an EA before you run it, independent reviews with live-tested results help. AlgoVerdict publishes them:
- Step-by-step guide for EA statistics with Magic Stats: https://algoverdict.com/en/guides/magic-number-statistics
- Independent EA reviews: https://algoverdict.com/en
Questions or a case where Magic Stats counts something differently from what you expect? Write in the comments, ideally with the deal list of one position (tickets, entry type, magic, volume). I read them all.
Past results shown by Magic Stats describe your own history only and do not predict future performance. Trading leveraged products carries a high risk of loss.
![[EURUSD]: Weekly Liquidity Activation Points (LAP), October 12-16, 2026 [EURUSD]: Weekly Liquidity Activation Points (LAP), October 12-16, 2026](https://c.mql5.com/6/1035/splash-preview-777305.png)
![[XAUUSD]: Weekly Liquidity Activation Points (LAP), October 12-16, 2026 [XAUUSD]: Weekly Liquidity Activation Points (LAP), October 12-16, 2026](https://c.mql5.com/6/1035/splash-preview-777299.png)
![[Nasdaq]: Weekly Liquidity Activation Points (LAP), October 12-16, 2026 [Nasdaq]: Weekly Liquidity Activation Points (LAP), October 12-16, 2026](https://c.mql5.com/6/1035/splash-preview-777311.png)