CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. Trade only with money you can afford to lose.
Open an FxPro account →

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 →

Min deposit $50 on Cent, Standard STP, RAW ECN and Swap Free; $10,000 on PRO ECN (broker's account terms, read 15 September 2026)  ·  Leverage settings up to 1:500 in the brand's own trading calculator (read 15 September 2026)

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

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

MQL4MQL5Why 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, BidSymbolInfoDouble(), SymbolInfoTick()Predefined price variables no longer exist
Open[], High[], Low[], Close[], Time[], Volume[]CopyRates(), CopyOpen(), CopyClose() and siblings6 direct series become an explicit copy into an array
Index 0 = current barIndex 0 = oldest elementSet 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

YearWhat happenedWhat it means for a port today
2002MetaQuotes begins releasing MetaTrader versionsThe lineage is over 20 years old, so legacy code is common
2005MetaTrader 4 and MQL4 releasedMost inherited strategies were written against this language
2010MetaTrader 5 and MQL5 released as a successor15 years of divergence between the two languages
2026MQL4 code is 21 years old and still in daily useInherited 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.

Frequently asked questions

Can I just recompile my MQL4 strategy for MetaTrader 5?
No. All 3 event handlers need renaming, every read of the current price becomes an explicit quote request, and the indexing direction of buffers and the 6 history series has to be set explicitly.
My migrated strategy compiles and trades. Does that mean it works?
Not necessarily. The indexing change is silent: the code runs while reading the series from the opposite end. Compare the close of 1 known historical bar against the chart before trusting the port.
I only have the compiled file, not the source. What now?
It cannot be migrated: the compiled form contains no source code. The 2 options are getting the original file from whoever wrote it, or rebuilding the logic from scratch.
Is there a reason to stay on MT4?
Yes — if the strategy works, the source is unavailable, or a rewrite is not worth paying for. After 20 years of MQL4 code, staying is a cost decision rather than a technical defeat.