An MT4 Expert Advisor cannot be run on MetaTrader 5 or cTrader as it is. MetaTrader 5 only runs programs compiled from MQL5 (.ex5), and cTrader runs cBots written in C#, so an EA written in MQL4 (.mq4 / .ex4) has to be rebuilt for the new platform. There are four ways to do that: rewrite the code yourself, pay a developer to port it, ask the EA's seller for an MT5 version, or rebuild it without code in a builder that exports more than one platform. With AlgoPuzzle, the no-code route is: import the EA's .mq4 source file, check the blocks the import report produces, then click Export to MT5 (or Export to cTrader) to get a new .mq5 Expert Advisor or .cs cBot. Whichever route you choose, you need the source code - a compiled .ex4 can't be read back - and you should compare the old and new versions in the Strategy Tester on the same symbol, timeframe and dates before switching, because data, spreads, account mode and stop handling differ between platforms. The rest of this article explains what actually changes between the platforms, compares the four routes, and walks through the conversion and the check step by step.
Why an MT4 EA doesn't run on MT5
MQL4 and MQL5 are different languages, and MetaTrader 5 does not run MQL4 programs. The two look similar on the surface - both have an OnTick function, both use the same chart timeframes - but the way an EA opens trades, reads indicators and tracks positions changed between them. Copying an .mq4 file into the MQL5 > Experts folder and compiling it fails with errors, and an .ex4 file is simply not recognised. cTrader is further away still: its cBots are C# programs using cTrader's own API.
The table below shows where a typical EA has to change. If you're still choosing a platform, MT4 vs MT5 vs cTrader compares them from a trader's point of view.
| What the EA does | MetaTrader 4 (MQL4) | MetaTrader 5 (MQL5) | cTrader (C#) |
|---|---|---|---|
| Source / compiled file | .mq4 / .ex4 | .mq5 / .ex5 | .cs / .algo |
| Open a trade | OrderSend() with symbol, type, lots, price, SL, TP; returns a ticket | OrderSend() with a trade request structure, or the CTrade class | ExecuteMarketOrder(), with stops given in pips |
| Read an indicator | iMA(), iRSI() return the value directly | iMA(), iRSI() return a handle; values are read with CopyBuffer() | Indicator objects created once, read through their result series |
| Trade size | Lots | Lots | Volume in units (lots can be converted with the symbol's settings) |
| Account mode | Hedging only: every trade is its own ticket | Hedging or netting: on netting, same-symbol trades merge into one position | Hedged or netted |
| "Invalid stops" error | 130 | 10016 | Reported in the cBot's Log |
| Where it runs | MQL4 > Experts, AutoTrading on | MQL5 > Experts, Algo Trading on | Automate, local or cloud instance |
Each row is a place where a hand-written port can go subtly wrong: a stop distance read in points instead of pips (see pips, points and lots), an indicator read from the wrong bar, or two trades that were separate on MT4 merging into one on an MT5 netting account.
Four ways to convert an MT4 EA, compared
The right route depends on what the EA does and whether you have its source code. A rule-based EA - indicator conditions, a fixed or %-risk lot, stop loss, take profit, maybe a trailing stop - can usually be rebuilt without code. An EA built around custom indicators or complex state logic is a job for a programmer.
| Route | Needs .mq4 source? | Needs coding? | Targets | Best for | Watch out for |
|---|---|---|---|---|---|
| Rewrite it yourself in MQL5 or C# | Yes | Yes, both languages | Anything | Programmers, unusual logic | Time; subtle differences in the table above |
| Hire a developer | Yes | No (you pay) | Anything | Complex EAs, custom indicators | Cost and turnaround; you still have to check the result |
| Ask the seller for an MT5 version | No | No | Whatever the seller offers | Bought EAs with only an .ex4 | May not exist; cTrader versions are rarer |
| Rebuild in AlgoPuzzle (import, then export) | Yes (.mq4, .mq5 or .cs, up to 512 KB) | No | MT5, MT4 and cTrader from the same blocks | Rule-based EAs, fxDreema exports | Custom indicators and multi-step logic aren't imported; check the report |
If the EA was built in fxDreema, note that fxDreema exports for MT4 and MT5 but not cTrader, and that every .mq4 / .mq5 file fxDreema exports carries the project inside it, which AlgoPuzzle can read back exactly for common blocks. fxDreema Alternatives covers the differences between the two builders, and Best No-Code EA Builders Compared covers the rest of the field.
How to convert an MT4 EA to MT5 or cTrader without coding (step by step)
The no-code route turns the MT4 EA into editable blocks first, then generates new platform code from those blocks. Nothing is translated line by line, so the new EA is AlgoPuzzle's own code, not a copy of the original file.
- Find the source file. In MetaTrader 4, File > Open Data Folder > MQL4 > Experts. You need the
.mq4, not the.ex4. If you only have the .ex4, ask the seller or the original builder for the source. - Import it. Open the builder, click Import and choose the file (or paste the code). A free account is needed. Details: Import a strategy.
- Read the import report. Every part of the original gets a status (see the next table). If anything is "Not imported", the new EA will not behave like the old one until you rebuild that part or accept the difference.
- Pick the symbol and timeframe. Many MT4 EAs trade whatever chart they're attached to; an AlgoPuzzle rule always names its own market and timeframe, so you choose them during the import.
- Check the blocks. Go through each rule: the IF condition, the trade with its lot, stop loss and take profit, and any CLOSE IF exit, trailing stop or break-even. Strategy rules and Trades, stops and lot size explain what each slot means.
- Run a quick backtest. The builder's backtester replays the rules on 1-minute MT5 data in the browser, which shows whether the imported strategy trades roughly when you expect. See Running a backtest.
- Export for the new platform. Click Export to MT5 for a
.mq5Expert Advisor or Export to cTrader for a.cscBot; installation steps for both are in Export to MT5, MT4 and cTrader. - Compare old and new in a tester, then on demo. See the checking section below.
The same route works in any direction: an .mq5 EA can be exported to cTrader or MT4, and a cTrader .cs cBot to MetaTrader.
What the import report tells you
The import report is the honest part of a conversion: it lists every piece of the original EA and says whether the rebuilt strategy does the same thing. Read it before anything goes on the canvas.
| Status | Meaning | What to do |
|---|---|---|
| Imported exactly | Rebuilt with blocks that do the same thing | A quick look |
| Imported with a difference | Mapped as closely as possible; a note says what differs | Decide whether the difference matters |
| Not imported | Affected trading, but has no AlgoPuzzle block, so it was left out | Rebuild it with other blocks, or accept that results will differ |
| Not needed | No effect on trading: chart drawing, comments, alerts | Nothing |
A second label says how the file was read. Exact import means the strategy was rebuilt from its definition, which is the usual case for simple fxDreema exports. Read by AI - check the blocks means hand-written or other builders' code was interpreted automatically: usually close, but a period, a comparison direction or which candle is read can be wrong, so compare every block with the original. AI reading takes up to a minute per file and is limited to a few files per account per day.
What converts cleanly and what doesn't
Rule-based logic built from standard indicators converts well; anything that needs code AlgoPuzzle has no block for does not. This is the quickest way to tell, before you start, whether the no-code route fits your EA.
| Part of the EA | No-code rebuild? | Notes |
|---|---|---|
| Built-in indicators: moving averages, RSI, MACD, Bollinger Bands, ATR, Stochastic, ADX, Ichimoku, CCI | Yes | See Indicators and values |
| Comparisons, crosses, rising / falling, AND / OR / NOT | Yes | See Conditions |
| Fixed lot or lot from a % of the balance | Yes | Background: position sizing |
| Stop loss and take profit in pips | Yes | Background: stop loss vs. take profit |
| Trailing stop and break-even | Yes | Background: trailing stop loss |
| Exit rule (close when a condition becomes true) | Yes | The CLOSE IF slot |
| Trading hours and days | Yes | Set on the rule |
| Custom indicators (iCustom) | No | Needs a programmer, or a rule rebuilt from built-in indicators |
| Multi-step logic: counters, flags, state carried between trades | No | fxDreema or hand-written code can express this; AlgoPuzzle's rule slots can't today |
| Martingale or grid lot progression | No | Worth reading why martingale and grid strategies blow up before porting one anyway |
How to check the converted EA against the original
A converted EA is only proven when its trades match the original's on the same test. Run both in a Strategy Tester with identical settings and compare the trade lists, not just the final profit - two different strategies can end with similar totals.
| Setting | Keep it identical | Why |
|---|---|---|
| Symbol and timeframe | Yes | Different bars, different signals |
| Date range | Yes | Pick a period you know the original's results for |
| Lot size and starting balance | Yes | %-risk sizing depends on the balance |
| Spread / modelling | As close as the platforms allow | MT5's "Every tick based on real ticks" is closest to live; MT4 and cTrader model differently |
Expect small differences even after a perfect conversion. These are the usual reasons, and none of them means the conversion is wrong:
| Cause of a difference | What it looks like |
|---|---|
| Different price history between MT4, MT5 and cTrader servers | A signal fires one bar earlier or later, or not at all |
| Spread and slippage modelling | Slightly different entry and exit prices |
| MT5 netting account | Two trades on the same symbol appear as one position |
| Stops managed by the EA instead of sent to the broker | An AlgoPuzzle export shows no SL/TP in the Trade tab; it closes trades itself and logs "Virtual Stop Loss triggered" |
| Something marked "Not imported" | Trades the original took (or skipped) differ systematically |
For the MetaTrader side, How to Backtest an EA in the MT5 Strategy Tester walks through the settings. If the new EA runs but opens nothing on a live chart, go through EA Not Opening Trades in MT5?; if its stops are rejected, see the invalid stops error (130 / 10016). Then run it on a demo account before real money - backtesting vs. demo trading explains why both steps matter.
Guides for each step of the conversion
Every step above has its own detailed page. Use this table as a map.
| Step | Read |
|---|---|
| Choose the target platform | MT4 vs MT5 vs cTrader: Which Should You Automate On? |
| Understand what an EA is made of | What Is an Expert Advisor (EA)? |
| Import the .mq4 / .mq5 / .cs file | Import a strategy (documentation) |
| Coming from fxDreema | fxDreema Alternatives: Free No-Code EA Builders Compared |
| Backtest in the browser | Running a backtest and Reading backtest results |
| Export and install on MT5 or cTrader | Export to MT5, MT4 and cTrader |
| Compare in the Strategy Tester | How to Backtest an EA in the MT5 Strategy Tester |
| Don't trust a too-good result | What Is Curve Fitting? and What Is Profit Factor? |
| Fix problems after going live | EA Not Opening Trades in MT5? and Troubleshooting and FAQ |
Common questions
Can MetaTrader 5 run an MT4 Expert Advisor?
No. MetaTrader 5 runs only Expert Advisors compiled from MQL5 (.ex5). An MT4 EA (.mq4 source or .ex4 compiled file) has to be rewritten or rebuilt for MT5; copying the file into the MQL5 folder does not make it work.
Can I convert an .ex4 file to MT5?
Not directly. An .ex4 is compiled, so its rules cannot be read back reliably. You need the .mq4 source code, or a precise written description of the rules, to rebuild the EA for MT5 or cTrader. If you bought the EA, ask its seller whether an MT5 version exists.
Is there an official MQL4 to MQL5 converter?
MetaEditor has no button that turns an .mq4 file into a working .mq5. The usual routes are rewriting the code by hand, hiring a developer, or rebuilding the strategy in a builder that exports both formats, such as AlgoPuzzle, which can import the .mq4 source and export it for MT5 or cTrader.
Can I convert an MT4 or MT5 EA to a cTrader cBot?
Yes, by rebuilding it, because cTrader cBots are written in C# rather than MQL. In AlgoPuzzle you import the .mq4 or .mq5 source, check the blocks, and click Export to cTrader to get a .cs cBot. Then compare both versions in their testers before trading.
Will the converted EA give the same results as the original?
Close, but rarely identical. Different price data, spreads, account mode (netting or hedging) and the way stops are handled all change individual trades. Run both versions in the Strategy Tester on the same symbol, timeframe and dates and compare the trade lists before switching.