What a magic number is
MT5 lets an EA attach a whole number to every order it sends. It is called the magic number, and EAs use it to recognise their own trades: an EA with magic 20231 looks after trades marked 20231 and leaves the rest alone.
Most EAs let you set the magic number in their Inputs. Some pick one for you. Trades you open by hand, from the MT5 window or the mobile app, get magic 0.
Why it matters for results
If you run one EA per account, the account's results are the EA's results. Many traders do not: three EAs on different pairs, sharing one account, is common.
The account's equity then tells you how the three did together, but not which one is carrying the others. One EA can be losing slowly while the other two hide it. Because each trade carries its magic number, it is possible to split the results apart again, with no change to any EA's code.
Naming strategies in Quantrivance
The Strategies page lists every magic number the Agent has seen on each account, with its own results: profit and loss after commission, swap and fees, the number of closed trades, and more. New magic numbers appear on their own, on the Agent's next report.
A number like 20231 is hard to remember, so give each strategy a name: the EA's name and the pair, for example. The name is only for you; it changes nothing in MT5.
Magic 0 is labelled as orders opened by hand. Account-level entries, such as broker rebates, are counted in the account's results rather than under any one EA.
Binding a chart for the kill-switch
To stop one EA from your phone, Quantrivance needs to know which chart it runs on, because closing the chart is what stops an EA. MT5 does not tell other programs which magic number an EA uses, so you make the link yourself, once.
On the Strategies page, under EA control, bind each magic number to the chart of the EA that trades it. The list shows the charts the Agent sees, with their symbol, timeframe and EA name. Charts that look the same are told apart by the order they were opened in.
The binding follows that chart. If you close it and attach the EA to a new chart, the page says the bound chart is not open, and you bind the new one. Emergency stop explains the rest.
Common mix-ups
- Two EAs with the same magic number. Their trades become one strategy, and you cannot split them afterwards. Give every EA its own number before it trades.
- One EA on two pairs with the same magic. Results for both pairs are counted together. If you want them apart, give each chart a different magic.
- Changing an EA's magic number. Trades from before and after the change show as two strategies. Name the new one and you can still compare them.
- Opening a trade by hand on an EA's pair. It is counted under magic 0, not under the EA, even if the EA later manages it.
In Quantrivance
Every EA, its own results
The Strategies page splits every account by magic number, with names you choose, and shows next to each one whether a kill would stop its EA. Connect an account and your strategies appear on the next report.
This post is for education and is not investment advice. Examples use made-up figures, not anyone’s results. Trading carries risk.

