Skip to main content

What is a Magic Number?

The Magic Number is the unique ID of an EA and is assigned to the trade it takes. Magic Numbers in MT5 are used to keep the actions of EAs limited to their own trades.

Updated over a week ago

Every Expert Advisor (EA) you build in Profectus AI needs a unique Magic Number. This number acts as an ID tag that allows MetaTrader to distinguish trades made by different EAs running on the same account.

Without unique Magic Numbers, your EAs can interfere with each other — closing, modifying, or managing trades that don’t belong to them. You do not want this to happen.

Some key information on Magic Numbers:

  • If two bots share the same magic number, they will interfere with each other’s trades (mixing orders, stops, and results).

  • Always give each bot its own magic number to ensure trades stay separated.

  • When you export a bot from Profectus AI, it will automatically have an input field that allows you to change the magic number in Metatrader 5, through the EA settings.

    Example:

    System 1 → 7777

    System 2 → 8888

    System 3 → 9999

    System 4 → 6666

  • By default, Magic Numbers are the same for each EA. Make sure to change them when installing your EA on your trading account in Metatrader 5.

You can change the MagicNumber directly from your EA in Metatrader 5. This is the safest option to ensure that when installing EAs on your account, you assign a unique Magic Number to the EA when checking the settings.

You can also assign a Magic Number in the Project Properties section in the Profectus builder.

Did this answer your question?