drawguard.io logodrawguard.io
GuidesCompareLive demo
Guides

How to see the magic number of a trade in MT5

Updated Nov 9, 2026 · 5 min read

Short answer: right-click the column headers of the Trade tab in the Toolbox and tick Magic. Do the same in the History tab for closed trades. If you'd rather not add a column, hover over a position, order or history line and the magic number shows in a tooltip. A magic of 0 means the trade was placed by hand, not by an EA.

This guide covers where to look, why a magic number sometimes goes missing, and how to make sure every EA you run gets its own number so you can read the column at all.

Where MT5 shows the magic number

MT5 shows a trade's magic number in three places. All of them are in the Toolbox (press Ctrl+T if it's closed).

WhereHow to see magic
Trade tab (open positions and orders)Right-click the column headers and tick Magic. Or hover over the line for the tooltip
History tab (closed trades)Same: right-click the headers and tick Magic, or hover for the tooltip
History tab, Positions and Deals viewHover over the opening deal of a position

MetaQuotes added the tooltip in build 975, shown "in the list of open positions and orders, as well as in the trading history". The Magic column came in build 2450 (May 2020), described there as "the identifier of orders and positions opened by the Expert Advisor", and "the new columns can be shown/hidden using the context menu". If you don't see the option, update the terminal.

The column shows only the number, not the EA's name, so keep a note of which number belongs to which EA.

What the magic number is

A magic number is an ID an EA attaches to every order it sends (ORDER_MAGIC in MQL5). The positions that come from that order carry the same number as POSITION_MAGIC. It's how an EA recognises its own trades, and how you tell several EAs apart on one account.

  • Manual trades normally have magic 0. If you see 0, you or a mobile app placed it, not an EA.
  • It's fixed when the position opens. You can't edit it afterwards.
  • MT5 doesn't enforce uniqueness. Two EAs, or one EA on two charts, can use the same number. Then their trades look identical in the column.

Why a magic number can be missing

Two cases catch people out.

You closed an EA's trade by hand. A user on the MQL5 forum reports that when they close an EA-opened position from the Trade tab, the closing line in the History tab shows no magic number, while it stays when the EA closes the trade itself. A reply in the same thread blames the broker's handling. Either way, the opening deal normally keeps the number. Switch the History tab to Positions and Deals (right-click, Statement) and hover over the opening deal, as the thread suggests.

The comment is unreliable. Brokers can rewrite a closing deal's comment, so don't rely on comments to identify an EA. Use them as a label and the magic number as the ID. Here is why the comment changes on closed trades.

If a trade has magic 0 and you didn't place it, check whether an EA with no magic input sends orders without one. Some do.

Which EA owns a magic number?

The column gives you the number, not the owner. To match them up:

  1. Open each chart's EA inputs (F7, or right-click the chart, Expert Advisors, Properties) and read the MagicNumber or Magic input. Some EAs call it ExpertID.
  2. Write down chart, EA and number.
  3. If the EA has no magic input, read its manual. Some use a fixed number, so two copies would clash.

If two EAs show the same number, change one before it opens new trades. Positions already open keep the old number.

How to give every EA its own magic number

Most EAs expose the magic as an input. Before the EA trades:

  1. Attach the EA to its chart and open the Inputs tab.
  2. Set a number nobody else uses. A scheme like 1101, 1102, 2101 (strategy, then instance) is easy to remember.
  3. Save it in the set file if the run is a separate strategy.
  4. Check the Magic column after the first trade to confirm it landed.

If you write EAs, the standard library sets it with CTrade::SetExpertMagicNumber.

For the full setup of several EAs on one account, including hedging versus netting, see running multiple EAs on one MT5 account.

Which EA is carrying the risk?

The Magic column answers "which EA opened this?". It doesn't answer "which EA is pushing my account toward its drawdown limit?". MT5's reports measure drawdown for the whole account, and closed history can't tell you how far each EA's open positions went before they closed.

See it on a live demo portfolio

Three simulated prop accounts in DrawGuard. Drawdown broken down by symbol, magic number and comment. No sign-up needed.

Open the demo →

DrawGuard records it while it happens. A free EA on one chart sends the account's equity and every open position, with its symbol, magic number, comment and floating profit, every 60 seconds to a web dashboard. Every day, week and month is broken down by symbol, magic number and comment, so you can see which magic caused each drawdown, and charts filter by the same. You can try it on the live demo without signing up. Details in drawdown per EA by magic number.

Two limits. Data starts when the EA connects (closed trades can be imported, floating drawdown from before can't), and the terminal has to keep running. DrawGuard monitors and warns; it never places or closes trades.

FAQ

How do I see the magic number of an open trade in MT5?

Open the Toolbox, go to the Trade tab, right-click the column headers and tick Magic. You can also hover over the position to see it in a tooltip.

How do I see the magic number of a closed trade?

Use the History tab. Right-click the headers and tick Magic, or hover over the line. If the closing line shows none, switch to Positions and Deals and hover over the opening deal.

What does magic number 0 mean in MT5?

Magic 0 normally means the trade was placed manually, not by an EA. An EA that sends orders without setting a magic also shows 0.

Can I change the magic number of a trade?

No. It's set when the position opens. To change what an EA uses, change its magic input before it opens new trades.

See your own drawdown per EA, live

Attach the DrawGuard EA to one chart and every strategy on the account is tracked from then on: equity, drawdown, and which magic number caused it. One account is free forever.

Explore the live demo →Start free

More guides

  • How to check the correlation between your EAs in MT5

    Do your EAs lose on the same days? How to measure correlation between EAs from daily profit per magic number, and what a good or bad number means for drawdown.

  • Maximal vs relative drawdown in the MT5 Strategy Tester report

    How to read the absolute, maximal and relative drawdown lines in an MT5 Strategy Tester report, with a worked example, and how they compare with live drawdown.

  • How to find the maximum drawdown of a live MT5 account from its history

    MT5's reports can give a maximum drawdown from closed history, but floating drawdown from the past is estimated, not recorded. What you can get and what to record from now on.

drawguard.io provides trading risk analytics for informational purposes only — not financial advice, not trading signals. Past performance does not guarantee future results.

Guides·Compare·Privacy Policy·Terms of Service·Refund Policy·Risk Disclaimer·Contact

© 2026 TRADEINTEL (Pty) Ltd · drawguard.io · Reg. 2026/445160/07