Automation· Glossary

What Is a Magic Number in MT4 and MT5?

A magic number is the integer an Expert Advisor stamps on every order it opens, so one account can hold several strategies and still be read one by one.

A magic number is an integer that an Expert Advisor writes onto every order it sends, and that MetaTrader carries for the life of the trade. It exists so that several strategies can share one account and still be told apart afterwards. Trades placed by hand carry zero.

How it works

The number is a parameter of the order-sending call, set by the code, not by the broker or the platform.

MT4:  OrderSend(symbol, cmd, lots, price, slip, sl, tp, comment, magic, ...)
MT5:  request.magic = 55566;   → carried onto the position and every deal
Manual click:  magic = 0

Three properties follow from that, and all three catch people out.

  • Nothing validates it. No component checks the value for uniqueness or meaning. Two EAs configured with the same integer are merged permanently in the record, and each one will treat the other's positions as its own to manage.
  • Zero is a real value, not an empty one. It is what a manual click carries, and also what any EA whose magic input was never changed from its default carries, so the two become the same thing.
  • It cannot be added later. The value is fixed the moment the request leaves the terminal and stored with the trade; history that arrived as zero remains zero for good.

Other platforms express the same idea in a different field: a cBot on cTrader writes a text label, TradeLocker attaches a strategy id to the order, and a numeric one is read here as a magic number. In practice the per-strategy split is MT4 and MT5 territory.

Why it matters

Run three strategies on one account and every headline number on the page is a blend. Profit factor, win rate, drawdown and the equity curve are all computed on the merged stream, so a strategy that loses steadily can sit inside a winning total for months without ever showing up as a line on any chart. The account looks healthy because, in aggregate, it is.

The magic number is the only field that survives that merge. Set properly, your history arrives already split into separate track records you can compare, size differently or retire one at a time. Set carelessly, no analysis performed afterwards can reconstruct it.

What the data shows

This one field carries more weight here than most owners realise, because the automation figure on every account page is computed from it: a trade is counted as automated when it arrives with a non-zero magic number, or with a strategy label on the platforms that use one instead. Across the public accounts on ShowMyTrades with trading history (August 2026) the median autotrading share is 99% and 53.9% of accounts are more than 90% automated, which is the same statement as saying nearly every order on those accounts turned up already tagged.

The reason to label early is sample size. The median account has 171 closed trades. Split across three strategies that is roughly fifty-seven each, below the point where a win rate or a profit factor carries information. Tagging from the first order is what gets each strategy to a readable sample before you have to make a decision about it. The alternative — one account per strategy — is common here too: 699 users run more than one account and 429 across more than one broker.

Where you see it on ShowMyTrades

The Breakdown Statistics module — listed as Currency Pair Statistics in your account settings — carries a By Magic Number tab next to By Symbol, which appears as soon as the account has closed trades to break down. Each row shows EA / Strategy, the raw Magic Number, trades, profit, and won/lost counts with percentages. The row for magic 0 is labelled Manual, and it is the one row that cannot be renamed: it is not a strategy, it is everything that arrived untagged.

The EA / Strategy cell is editable in place, which is how 55566 becomes a name you will still recognise in six months. Those names then follow the data: the Closed Trades table under Trade History & Balance Progression offers a Magic column carrying the raw integer per ticket, and the Custom Analysis slideover has a Magic Numbers filter whose chips read Manual (0) or Label - 55566. Select one and every statistic on the page is recomputed for that strategy alone.

Common misunderstandings

  • "I will set magic numbers later." Later does not exist. The field is written at order time and past trades cannot be re-tagged.
  • "My EA handles it automatically." Only if the input was changed. A default of 0 is common and silently merges the EA with your manual trades.
  • "Manual means I traded by hand." The manual row is the untagged bucket: hand-placed trades plus every EA left at zero.
  • "The magic number tells you which robot it is." It tells you nothing. 55566 is whatever the author typed.

The full workflow, from naming a strategy to finding the one quietly losing money: magic numbers and strategy labels.