MetaTrader 4 (MT4) · Malaysia
MetaTrader 4 runs strategies written in MQL4; MetaTrader 5 runs MQL5. Released 5 years apart, in 2005 and 2010, they are different languages rather than 2 versions of one — and that single fact decides whether working code can follow you across.
Open an FxPro account →MQL4 and MQL5 are different languages — MQL4 shipped with MetaTrader 4 in 2005, MQL5 with its successor in 2010 — so an MQL4 strategy does not move across by recompiling. All 3 event handlers were renamed, the predefined current-price variables were removed, and indicator buffers default to the opposite indexing direction, which compiles cleanly while returning values read from the wrong end of the series. A strategy held only as a compiled file cannot be migrated at all, because the compiled form carries no source code.
MetaTrader 4 (MT4) at Vantage Markets
- MQL4 (2005) and MQL5 (2010) are separate languages: source written for one does not compile on the other without edits.
- All 3 event handlers were renamed, so the old entry points are never called and a ported program does nothing.
- The predefined current-price variables of MQL4 have no MQL5 equivalent: every price read becomes an explicit quote request.
- The 6 direct history series are gone, replaced by copying the range you need into an array first.
- Indicator buffers flip indexing: position 0 is the current bar in MQL4 and the oldest element in MQL5.
- A strategy held only as a compiled file cannot be migrated at all — after 20 years of MQL4 code, this is a common case.
Which Vantage Markets platform should you use?
Pricing is set by the account line, not by the terminal, so the side-by-side comparison of platforms lives in one place: the MetaTrader 5 page. What differs between MT4 and MT5 is covered in the section above; what differs between the five account lines is on the main page.
Get started
Download MetaTrader 4 (MT4) from your client area after you open an account, or try it first on a free demo.
Open an FxPro account →What breaks when an MQL4 strategy moves to MQL5
This is not a version upgrade. MQL4 shipped with MetaTrader 4 in 2005, MQL5 with MetaTrader 5 in 2010, and those 5 years went into redesigning the language rather than extending it. The incompatibility belongs to the platforms, not to whoever holds your account.
All 3 entry points an MQL4 program is built around — initialisation, per-tick and shutdown — carry different names in MQL5. The old names are simply never called, so a ported program loads, sits there and does nothing.
Price access goes next. MQL4 exposes bid and ask as predefined variables readable anywhere; MQL5 has none, so every read becomes an explicit quote request. The 6 direct history series are gone too, replaced by copying the range you need into an array first. Both edits scale with how often your logic touches prices — usually more places than the author remembers.
The failures that still compile
The dangerous breakage is the one the compiler accepts. In MQL4 position 0 of a series is the current bar, counting backwards into history. In MQL5 arrays — indicator buffers included — default to forward indexing, where position 0 is the oldest element.
Nothing here is a syntax error. The ported code compiles, reads position 0 as it always did, and gets the wrong end of the series: a strategy built to react to the newest bar quietly reacts to the oldest one, placing real orders while doing it. Setting the indexing direction explicitly fixes it — but only if you know the problem exists.
So «it compiled» is not a migration test. Read the close of 1 specific historical bar in the ported code and compare it with that bar on the chart. If the 2 disagree, indexing is inverted and every signal derived from that series is suspect.
Compiled-only strategies, and why they do not migrate at all
Before estimating any of that work, answer one question: do you hold the source file, or only the compiled one?
A compiled strategy is a build artefact. It carries no source code and is not readable back into the language it was written in, so if your only copy is compiled there is nothing to port. The migration question becomes 2 others: can the original author supply the source, and if not, is the logic worth rebuilding from scratch? Strategies are often distributed compiled precisely so the logic stays private, which makes this the budget-and-ownership question rather than a technical one.
Who has a reason to stay on MT4
Staying is a legitimate answer, and the right one more often than migration guides admit. If the strategy works, the source is unavailable, or a rewrite costs more than the difference is worth, the working platform is the one your code already runs on — 20 years of MQL4 code exists because it kept working.
Two conditions point the other way: logic that needs opposing positions held on 1 instrument, or reach into asset classes beyond forex. The newer terminal handles both more directly, and that comparison — with everything about choosing and installing a terminal — lives on the MetaTrader 5 page, not here. If you have no MQL4 code at all, this page is not yours: terminal choice is on the MT5 page, and practising without funding anything is on the demo page.
MQL4 construct and what replaces it in MQL5
| MQL4 | MQL5 | Why the edit is needed |
|---|---|---|
| init() | OnInit() | Renamed entry point: the old name is never called |
| start() | OnTick() | Renamed per-tick handler: a ported program loads and does nothing |
| deinit() | OnDeinit() | Renamed shutdown handler |
| Ask, Bid | SymbolInfoDouble(), SymbolInfoTick() | Predefined price variables no longer exist |
| Open[], High[], Low[], Close[], Time[], Volume[] | CopyRates(), CopyOpen(), CopyClose() and siblings | 6 direct series become an explicit copy into an array |
| Index 0 = current bar | Index 0 = oldest element | Set ArraySetAsSeries() explicitly or read the wrong end |
6 construct groups, and only the last of the 6 compiles cleanly while returning wrong values. Checked against MetaQuotes documentation and the platform's public history on 15 September 2026; the 3 handler renames alone stop a ported program from running at all.
Timeline of the two languages
| Year | What happened | What it means for a port today |
|---|---|---|
| 2002 | MetaQuotes begins releasing MetaTrader versions | The lineage is over 20 years old, so legacy code is common |
| 2005 | MetaTrader 4 and MQL4 released | Most inherited strategies were written against this language |
| 2010 | MetaTrader 5 and MQL5 released as a successor | 15 years of divergence between the two languages |
| 2026 | MQL4 code is 21 years old and still in daily use | Inherited strategies are normal, not a sign of neglect |
Dates per the platform's public history, read on 15 September 2026. A strategy written in 2005 terms does not become a 2010 program by recompiling, and 21 years of accumulated MQL4 code is why the question keeps coming up.