MQL4 vs MQL5: What's the difference?
They share a name and a lot of syntax, but MQL4 and MQL5 are different languages for different platforms — and an EA built for one won't run on the other without real rework.
The differences that actually matter
Different platforms entirely
MQL4 runs in MetaTrader 4; MQL5 runs in MetaTrader 5. They're separate applications, and code written for one doesn't run in the other without being rewritten.
Position handling
MT4 is hedging-only — you can hold multiple opposing positions on the same symbol. MT5 defaults to netting (positions on the same symbol merge into one), with hedging available as an account-level setting depending on the broker.
Language structure
MQL5 is built around a fuller object-oriented model with a standard class library (CTrade for order execution, CExpert for strategy scaffolding, and more). Older MQL4 code tends to be more procedural, though MQL4 has adopted much of MQL5's syntax over time.
Indicator access
MQL5 uses indicator handles plus CopyBuffer() to read values — an extra setup step compared to MQL4's older direct-call style, but it scales better for multi-symbol, multi-timeframe strategies.
Timeframes and testing
MT5 supports more built-in timeframes and a more capable Strategy Tester, including multi-currency backtesting in one pass — useful if a strategy trades several pairs at once.
Which one should you use?
If you're starting fresh, MQL5 on MetaTrader 5 is the more current, actively developed option, with a broker ecosystem that's largely moved that direction. MT4 still has a large installed base, mostly for legacy reasons and specific broker/regional preferences.
Give us your trading strategy
Describe it in plain language and see exactly what your bot will do. Free, no account needed.
Build My EAYour first EA is free.