MQL4 to MQL5 converter
Move your MetaTrader 4 Expert Advisors to MetaTrader 5, or back. Paste your code below to see the result: the conversion runs in your browser and your code is not uploaded.
Things to check
Create a free account to convert, download and keep whole files, with no limit.
Get the full file freeHow the converter works
Most converters try to rewrite every line, which breaks code in subtle ways. QuantForge keeps your code as it is and adds the other platform’s versions of the functions it calls: OrderSend, OrderSelect, iMA, iRSI, AccountBalance, MarketInfo and the rest are rebuilt for MetaTrader 5 on top of positions, deals and indicator handles. Only what can’t work that way is rewritten:
Bid,Ask,Close[1]and the other price arrays,externvariables, which becomeinput(with a copy when your code changes them),- the old
init,startanddeinitfunctions, which becomeOnInit,OnTickandOnDeinit.
The result compiles in MetaEditor 5 and keeps your comments, names and structure, so you can still read and maintain it.
Notes you can act on
Every conversion ends with a list of things to check, with line numbers. For example: an iCustom call that needs the indicator converted too, a DLL import that must be 64-bit on MetaTrader 5, arithmetic with Period(), or ERR_ error codes that MetaTrader 5 numbers differently.
After converting
- Open the
.mq5file in MetaEditor and compile it, or build it in one click in QuantForge (Pro). - Run it in the MetaTrader 5 Strategy Tester on a hedging account, with the same symbol and dates as before, and compare it with the MetaTrader 4 results.
- Test it on a demo account before going live.
Prefer to start fresh? Rebuild the strategy from blocks in the no-code EA builder and export it for both platforms from one project.
Frequently asked questions
Is the MQL4 to MQL5 converter free?
Yes. Converting source code is free on every plan, including the free plan. This page shows a preview; with a free account you convert, download and keep whole files. Building the converted EA into an .ex5 or .ex4 in one click is part of Pro.
Will the converted EA trade exactly like the original?
Your code keeps its own logic, and the converter adds MetaTrader 5 versions of the MQL4 functions it calls. Some differences are about the platform, not the code: MetaTrader 5 netting accounts merge trades on a symbol into one position, and Period() returns different values. The converter lists those points with line numbers. Always run the result in the Strategy Tester before trading it.
Can it convert an .ex4 file to .ex5?
No. A compiled .ex4 holds no source code, and taking one apart is against MetaTrader's terms. QuantForge rebuilds only the .ex4 / .ex5 files it built for your own account. For any other EA, convert its .mq4 source.
Does it convert indicators?
Not yet. It converts Expert Advisors and scripts. When an EA reads a custom indicator with iCustom, the converter tells you to convert that indicator too and where to put it.
Does it work from MQL5 to MQL4?
Yes. It converts MQL5 Expert Advisors and scripts to MQL4, including positions, CopyBuffer reads and indicator handles. Code built on MQL5's standard Expert classes isn't converted, and the converter says so.
Build your first EA today
The free plan includes three projects, backtests on H1 to D1 over a year, MQL4/MQL5 export and the converter.