Running Two EAs on One Account: Magic Numbers and Margin

Two EAs can share an account, and they do it safely only when each one can tell its own trades apart from the other's. That is what a magic number is for. The second half of the problem is harder and gets skipped: both EAs draw on the same free margin, and neither one knows the other exists.

Last updated 30 September 2026

The magic number in one paragraph

When an EA sends an order it can attach an arbitrary integer to it. That integer is the magic number, and it is stored with the position for its whole life.

From then on, the EA looks through the open positions and works only on the ones carrying its number. Everything else — your manual trades, the other EA's grid — is invisible to it. Without that filter, an EA assumes every position on the account is its own.

Setting them up

Give each EA a distinct number and keep a note of which is which. Round, memorable values are easier to recognise later in the Trade tab: 1001 for the first, 2002 for the second.

Two details that catch people out:

An EA may use more than one number. A strategy running several baskets often derives a range from the number you give it: set 69 and it may use 69, 70, 71 and 72 internally. Leave a gap between EAs rather than setting 69 and 70 side by side.

Manual trades carry magic number 0. If an EA is written to manage "everything with magic 0", your own hand-placed trades are inside its remit. Read the manual before assuming otherwise.

One chart per EA

MetaTrader allows exactly one EA per chart. Running two on EURUSD means two EURUSD charts, each with its own EA attached, each with its own settings.

Make it obvious which is which: put the EA name in the chart's template or comment, or use different colour schemes. When something goes wrong at three in the morning, being able to see at a glance which chart holds which strategy is worth the two minutes it takes.

The part that actually breaks accounts: shared margin

Magic numbers stop the EAs interfering with each other's orders. Nothing stops them competing for the same money.

Each EA looks at free margin and decides it can afford its next position. Neither one knows the other is about to open three more. On a quiet day this is invisible; on the day both strategies are in drawdown at once, one of them runs out of margin halfway through a sequence and stops where it stands.

For grid strategies this is the dangerous case, because a grid that cannot open its next level is left holding losing positions with no mechanism to recover them. The arithmetic behind that is in grid vs martingale.

How to size for two

  1. For each EA, work out the margin needed for the worst case it can reach: the largest position set it will hold, at your leverage.
  2. Add the two worst cases together, not the averages.
  3. Compare with the account balance. If the total is more than about half, run them on separate accounts instead.

The reason for the half is stop-out. Margin level falling below the broker's stop-out percentage closes positions automatically, starting with the largest loser, and it does not care which EA opened it.

When to use separate accounts instead

Two EAs on one account is reasonable when both trade small fixed sizes, on different symbols, with stop losses.

Use separate accounts when either one is a grid or martingale, when they trade the same symbol in opposite directions, or when you want to be able to judge each strategy's results on their own. That last reason is the underrated one: with two EAs on one balance curve, you cannot tell which is carrying the other.

Most licences make this straightforward. Ours includes two account slots per plan, which is also what lets a demo run beside a live account.

Checking it works

After attaching both, open the Trade tab and let each EA place a position. Then:

Do this on a demo first. It takes ten minutes and it is the only way to know the two are genuinely separated rather than appearing to be.

Common questions

What is a magic number in MetaTrader?

A number an EA stamps on every order it places, so that later it can find its own positions and ignore everyone else's. Two EAs on the same account must use different magic numbers, or each will manage the other's trades as if they were its own.

Can I run two EAs on the same currency pair?

On a hedging account, yes, provided they use different magic numbers. On a netting account it is a bad idea regardless: MetaTrader merges all positions on a symbol into one, so the two EAs end up fighting over a single net position that neither of them can manage correctly.

Do I need a different chart for each EA?

Yes. MetaTrader allows one EA per chart. Two EAs on the same pair means two charts of that pair open, one EA attached to each.

What happens if two EAs use the same magic number?

Each treats the other's positions as its own. One may close a trade the other opened, modify its stops, or count it toward a basket it never placed. The results look random and are very hard to diagnose, which is why the number has to be set deliberately.