Skip to content
DDavinchu TradeOS
FeaturesProductsDashboardWho it's forPricingPartnersFAQBlog
EnglishEspañolРусскийУкраїнська中文PolskiDeutsch
Log inSign up
FeaturesProductsDashboardWho it's forPricingPartnersFAQBlogLog inSign up
Trading glossary

What is a magic number

A magic number is the number a MetaTrader Expert Advisor stamps on its orders and, through them, on deals and positions. The EA uses it to find «its» positions among other EAs' and manual ones, and the trader uses it to split the account result by EA. Trades opened by hand have a magic of 0.

Glossary sectionsMetaTrader and connectionUpdatedNovember 18, 2026

Trading glossary

Trading glossaryWin ratePayoffR (R-multiple)Equity drawdownLosing streakSortino ratioBenchmarkRealized and floating P/LSwapSetupFunded accountProfit targetMagic numberSpotPerpetual futuresUSDT-M and COIN-MRebalancingExpert Advisor (EA)AutoTrading (Algo Trading)FOMO

How it works in MetaTrader

An EA puts the number into the magic field of its trade request (in MQL5 an integer of type ulong; the standard CTrade class sets it with SetExpertMagicNumber). The number then stays on the order (ORDER_MAGIC), the deal (DEAL_MAGIC) and the position (POSITION_MAGIC). The MQL5 reference describes it as the ID of the Expert Advisor, meant for each EA to place its own unique number. Trades opened by hand have a magic of 0.

The number does two jobs. The EA itself picks «its» positions by symbol and magic, so it manages and closes only those. And when you analyse the account, magic splits the result between EAs and manual trading.

Example: the total hides a losing EA

Two EAs and manual trades share one account (model figures):

MagicSourceTradesResult
0manual40+$350
1001EA A120−$420
2002EA B60+$900
—whole account220+$830

The account is up, yet EA 1001 trades the most and loses money: without it the result would be +$1,250. A split by magic is the only way to see it.

Common mistakes

  • The same magic for two EAs on one symbol: each treats the other's positions as its own.
  • An EA selects positions without checking magic and closes manual trades.
  • Changing the magic while positions are open: the EA no longer recognises them.
  • A netting account: it holds one common position per symbol, so two EAs on the same symbol change one and the same position.

Magic numbers in Davinchu

The Davinchu Trade Monitor EA for MT5 and MT4 sends the magic of every trade, and the dashboard splits the account by it:

  • «Account settings» → «Magic numbers» tab (for MetaTrader accounts): how many trades each number has, with 0 shown as «Manual trades».
  • The trade card in the journal shows a «Magic» field.
  • In the account's public statement, the «Magic number analysis» table shows trades, win rate and result for each number — if the owner enables it under «Permissions».
  • AI review receives the results of each EA separately, while the «Tilt» alert counts manual trades only — EA trades are left out.
  • The «EA settings» tab (MT5) has a «Magic Number» field under «Filters»: 0 makes the monitor send every trade on the account, any other number — only that EA's trades.

What an EA is and how to launch one — see «What is an Expert Advisor (EA)» and «How to install an EA in MT5». How to judge someone else's EA by its statistics — «How to check an EA or a signal before buying».

Frequently asked questions

What magic does a manual trade have?

Zero: the EA sets the number in its trade request, and a trade opened by hand does not get one. That is how manual trades are told apart from EA trades.

Can two EAs share one magic number?

If they trade different symbols and select positions by symbol and magic, there is no conflict. On the same symbol, a shared number makes the EAs manage each other's positions.

Where can I see the result for each magic?

In Davinchu, trade counts per number are on the «Magic numbers» tab of the account settings, and the result and win rate per number are in the «Magic number analysis» table of the account's public statement.

Trading glossary →

Journal, risk manager and analytics in one dashboard

Free forever: 2 accounts, a journal and AI reviews. Setup takes 5–10 minutes.

Start for free
DDavinchu TradeOS

Analytics platform for traders and teams.

Products

Trading journalAccount analyticsAccount monitoringMT5 risk managerAI analyticsTrading calculators and toolsAll featuresWho Davinchu is for

Company

About usPricingSecurityPartnersBlogTrading glossaryDocumentationHelp centerContacts

Support

DocumentationHelp centerTelegram supportTelegram channel[email protected]

Legal

Privacy policyTerms of serviceRefund policyAML policy
© 2026 Davinchu. All rights reserved.Premium trading analytics platform
Davinchu dashboard demoOpen the live dashboard →