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.
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
- 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.
- Add the two worst cases together, not the averages.
- 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:
- Add the Magic Number column if your build shows it, or hover a position to see the comment the EA left.
- Confirm each EA reports its own count correctly, in its panel or in the Experts tab.
- Close one EA's position by hand and confirm the other does not react to it.
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.