MQL4 vs MQL5: What's the Difference, and Which Should You Learn?
MQL4 is the programming language of MetaTrader 4 and MQL5 is the language of MetaTrader 5. Both are used to write Expert Advisors (EAs), indicators and scripts, and both look like C++. But they are not compatible: MQL5 handles trades, indicators and price data differently, so code written for one platform has to be rewritten to run on the other. If you are starting today, learn MQL5.
What is MQL4?
MQL4 (MetaQuotes Language 4) arrived with MetaTrader 4 in 2005. It is simple and procedural: you check prices, call indicator functions that return values directly, and send orders. There are years of free MQL4 code, forum answers and tutorials, which is why it is still widely used.
What is MQL5?
MQL5 came with MetaTrader 5. It is closer to C++, with full object-oriented programming, a standard library (for example the CTrade class for placing orders), event handlers for timers, chart events and trade events, and a faster, multi-threaded Strategy Tester with real-tick testing.
The differences that matter
| MQL4 (MT4) | MQL5 (MT5) | |
|---|---|---|
| Trading model | Orders: each open trade is an order you select and modify | Orders, deals and positions are separate; accounts are netting (one position per symbol) or hedging |
| Placing a trade |
OrderSend() with a list of parameters |
A trade request structure, or the CTrade class |
| Indicators |
iMA(...) returns the value |
iMA(...) returns a handle; values are read with CopyBuffer()
|
| Prices | Built-in Ask, Bid, Close[]
|
SymbolInfoDouble(), CopyRates(), iClose()
|
| Strategy Tester | Single-threaded, one symbol, simpler modelling | Multi-threaded, multi-symbol, real-tick modelling, forward testing built in |
| Language features | Mostly procedural (newer builds added some classes) | Full object-oriented programming and a standard library |
| Compiled file | .ex4 |
.ex5 |
Why MT4 code won't run on MT5
The trading model is the main reason. An MQL4 EA loops through orders with OrderSelect(); MQL5 tracks positions and deals instead, and on netting accounts several "orders" become a single position. Indicator calls and price access also work differently. That is why there is no reliable automatic converter; see can you convert an MT4 EA to MT5?
Which should you learn?
- Learn MQL5 if you are starting now. MetaQuotes develops MT5, most new broker features and most new EAs are built for it, and its tester is better for checking a strategy properly.
- Learn MQL4 only if you must maintain existing MT4 EAs or your broker only offers MT4.
- Learn neither if you only want EAs, not programming: EA builders and generators produce MT4 and MT5 EAs without code. See how to make an Expert Advisor for MT5.
Nebula, the EA software we make, compiles each system it builds into either an .ex4 or an .ex5, so you can stay on the platform your broker supports. See how Nebula works, or read MT4 vs MT5 for EAs for the platform side of the decision.
Frequently asked questions
What is the difference between MQL4 and MQL5?
MQL4 is MetaTrader 4's language and MQL5 is MetaTrader 5's. MQL5 separates orders, deals and positions, reads indicators through handles and CopyBuffer, supports full object-oriented programming and has a faster multi-threaded tester. The two are not compatible, so code must be rewritten to move between them.
Is MQL5 harder than MQL4?
A little at first, because trading and indicator calls take more steps. Its standard library, such as the CTrade class, makes common tasks simpler once you know it.
Can MQL4 code run in MetaTrader 5?
No. MT5 cannot run .ex4 files or compile MQL4 code as-is. The EA has to be rewritten in MQL5 or rebuilt for MT5.
Should I learn MQL4 or MQL5 in 2026?
MQL5, unless you need to maintain existing MT4 EAs. MetaTrader 5 is where development and new broker features are, and its Strategy Tester is better for testing.
Do I need to learn MQL to make an EA?
No. EA builders and generators such as Nebula create MT4 and MT5 EAs without code.
Screens show backtests and simulations. Past performance is not a reliable indicator of future results. Trading involves risk to your capital.
Want the whole system, not just the tool?
76 complete trading systems, each tested on data it never saw, from £9.99. Buy 3 and save 15%.
Start free. Deploy one system.
See pricing › Or browse the ready made Systems Library ›
Download Nebula free · What Nebula does · Funded and prop firm traders · Free trading tools · Reviews · Discord · YouTube · About · Contact
- Free tier, no card: build, test and make one real deploy before you pay anything
- Runs on your own PC or Mac: your MT4/MT5 account stays with your broker
- 14-day cooling-off on any purchase before activation, in line with UK consumer law
- A real person answers: Ross, the founder, via contact or Discord
- Real reviews · Nebula on Trustpilot
Reviews on Trustpilot: Nebula & tools (Orion RFX) · private mentoring (Pip Surfing Society)
Watch AI trade, right on your phone.
In NESAB, five AI models run nine simulated portfolios on live prices. Every decision is logged with its reason. Follow one or all of them.
ROSS20Use the code when you subscribe after the free 3 day trial.
Why we partnered ›NESAB portfolios are simulated. Past or simulated performance does not guarantee future results.