Home › Automation › MT5 won't run my EA
Why MT5 won't run my EA (and how to find out)
When an Expert Advisor ‘does nothing’, it is almost never broken: there are six causes that explain the vast majority of cases, and all of them can be checked in five minutes. The order matters: starting with the code when the problem was a permissions issue is the most common way to waste an afternoon.
The six causes, in order of frequency
| Symptom | Common cause | Check |
|---|---|---|
| The Expert Advisor is on the chart but nothing happens | The algorithmic trading is disabled: the button on the top bar, the terminal's global permission or the Expert Advisor's own permission. | ‘Algorithmic trading’ button in green (not red) and terminal settings with algorithmic execution allowed. Also, the corresponding permission must be ticked in the Expert Advisor's properties. |
| Only a sad face appears next to the name | The Expert Advisor has been added to the chart without trading permission or with initialisation errors. | Check the permissions in the Expert Advisor's properties and the ‘Experts’ tab: if initialisation failed, the reason appears there. |
| There are no messages or errors | The Expert Advisor is waiting for its entry conditions. An Expert Advisor with a trend, time or volatility filter can spend hours without trading by design. | Check in the code whether it prints messages and whether it has time or session filters. Watch out for the server time, which is not yours. |
| It tries to trade and does not enter | Execution rejection: stops too close to the price, volume below the minimum, insufficient margin, market closed or read-only account. | ‘Journal’ tab: the terminal logs the rejection with its error code. That code is the answer (check the official MQL5 documentation). |
| The symbol is not the right one | The expert advisor trades a specific symbol name, and on your broker it's called something different (or the chart is on another instrument). | Check the chart symbol and the one the expert advisor uses internally: they must match. Names change between brokers. |
| It works on demo but not on live | The live account has different available symbols, a different minimum volume, different margin or a different hedging mode. | Compare the symbol list, minimum volume, spread and account mode between demo and live. |
Five-minute diagnosis
- Algorithmic trading enabled (green bar at the top) and the expert advisor permission ticked.
- Look at the ‘Experts’ tab: Is the expert advisor printing anything? Did it initialise properly?
- Look at the ‘Journal’ tab: look for lines with ‘trade’, ‘order’ or ‘error’. That's where the rejection is, with its code.
- Check the chart: correct symbol, timeframe with data and price updating.
- Check the expert advisor's filters: schedules, sessions and thresholds that may never be met.
- Test with a minimal expert advisor that only tries to open a very small position without stops. If that works, the channel is fine and the problem is configuration or logic.
If the problem is in the code
- It doesn't compile: there's no executable file, so it can't be added to the chart. Check the ‘Errors’ tab in MetaEditor (file and line) and compile again.
- Initialisation fails: if the expert advisor aborts on start-up (for example, because it can't find the symbol or historical data), the terminal says so. A well-made expert advisor reports it in the Journal instead of staying silent.
- It uses data that isn't available yet: indicators that need more bars than there are, or history that hasn't been downloaded. On synthetic symbols with little history loaded, that's common.
- It sends orders with invalid parameters: the symbol's minimum stop distance, poorly rounded price or volume decimals (volume step).
Before blaming the broker
Server-side rejections do exist (market closed on a symbol with a schedule, read-only account, symbol disabled for that account type), but they're the minority. The test that rules it out is simple: a minimal expert advisor that tries to open the minimum permitted volume, without stops, on the correct symbol. If that order goes through, your execution channel works and the problem is in your configuration or your logic.
Frequently asked questions
Why does it appear on the chart but not open trades?
Because of disabled permissions, the wrong symbol, entry conditions that aren't met (or poorly adjusted time filters) or execution rejections due to stops, volume or margin. The Journal says which.
Where can I see why it isn't executing?
In ‘Experts’ (messages from the expert advisor itself) and in ‘Journal’ (server rejections with their error code).
Why does it work on demo but not on live?
Because available symbols, minimum volume, spread, margin and account mode change. Compare them before touching the code.
Can it be the broker?
It is possible, but rare. A minimal Expert Advisor that attempts a small, valid trade is enough to rule it out.
Does an uncompiled Expert Advisor run?
No: without a compiled file it cannot be added to the chart. Fix the errors and recompile.
Measure first, automate afterwards
At the academy, Expert Advisors are used for what risk requires: calculating position size according to risk, placing stops, respecting limits and schedules. See what can truly be automated.
Keep reading
- Installing an EA in MetaTrader 5 step by stepWhere the file goes, permissions and typical installation errors.
- How an EA works internallyEvent cycle, order sending and debugging with the Journal.
- Trading plan: what to write and how to review itAn EA executes rules: if they are not written down and measured, it automates chance.
- Stop loss in synthetic indicesWhy poorly placed stops cause rejections and premature exits.