When every EA trade lands in one MT5 account history, the account total can hide which strategy is helping and which strategy is hurting. Magic numbers solve that identity problem by tagging trades with a strategy-specific identifier.
What to track by magic number
At minimum, track net profit, floating P/L, max drawdown, symbol, average hold time and active version. If one magic number is profitable but creates most of the floating drawdown, it should not be judged only by closed P/L.
| Field | Why it matters |
|---|---|
| Magic number | Identifies the EA or strategy group. |
| Symbol | Separates behavior by market. |
| Version | Connects results to the settings that produced them. |
| Drawdown | Shows risk, not just outcome. |
Version your EAs
A magic number is not enough if the same EA changes settings every week. Add a version tag to your notes, comments or reporting workflow. Then compare version against version rather than treating the whole account as one experiment.
Do not ignore account-level risk
A magic number can look healthy while the account is overexposed because other EAs are correlated. Pair magic-number reporting with account monitoring, especially margin level and equity curve tracking.
Use a composite strategy identity
A magic number is an EA-supplied identifier, not a globally unique primary key. Treat it as one field in a composite identity that includes account, server, symbol and—when appropriate—strategy version. The same magic number can be reused on another account or by a copied trade. Manual trades may use zero, and some workflows can change or lose attribution.
Capture identity at the order, deal and position layers. MT5 distinguishes these objects: an order is an instruction, a deal is an execution, and a position is the resulting exposure. On netting accounts, multiple deals can contribute to one position, so attribution rules need to be documented rather than inferred from a final row.
Worked attribution example
Suppose magic 4101 runs EURUSD and GBPUSD on two accounts. Grouping only by 4101 merges four streams and can make a weak GBPUSD variant look profitable because EURUSD carried it. Group by account + server + magic + symbol first. If the EA version changes, add a deployment boundary so pre-change and post-change trades can be compared without rewriting historical identity.
Review each strategy slice
- Net profit after commission and swap, not gross trade profit alone.
- Win rate together with average win, average loss and expectancy.
- Maximum equity drawdown and peak simultaneous exposure.
- Trade count and time in market so small samples stay visible.
- Results by symbol, session and long/short direction.
Keep an “unattributed” bucket instead of silently dropping records with missing or conflicting magic data. Investigate sudden attribution changes after copier, broker or EA updates. Cross-check the resulting groups against the decision-grade journal metrics and EA risk checklist. Attribution is valuable when it changes a decision: reduce size, pause a variant, or investigate a deployment regression.
Govern the identifier registry
Maintain a small registry that maps magic number, EA name, version family and intended accounts. Reserve ranges if several teams or products deploy EAs, and validate new configurations against duplicates before release. The registry does not make the number globally unique, but it prevents accidental collisions inside the environments you control.
When a copier mirrors a trade, decide whether reports should preserve the leader’s strategy identity, record a copier-specific identity, or store both. That choice affects portfolio aggregation and must be consistent. Audit unmatched deals after every deployment: a rise in magic zero, an unknown ID or a previously unused account/symbol combination is a data-quality event, not miscellaneous noise.
Primary source
Technical reference: official MetaTrader documentation. Broker and prop-firm terms can differ; verify the rules for the exact account you operate.
xTriel helps keep MT5 account state visible while you evaluate EA performance.