AlgoPuzzle Open the Builder
← Back to all articles

Platforms

How to Convert an MT4 EA to MT5 or cTrader (Without Coding)

By AlgoPuzzle · Published · Updated

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 doesMetaTrader 4 (MQL4)MetaTrader 5 (MQL5)cTrader (C#)
Source / compiled file.mq4 / .ex4.mq5 / .ex5.cs / .algo
Open a tradeOrderSend() with symbol, type, lots, price, SL, TP; returns a ticketOrderSend() with a trade request structure, or the CTrade classExecuteMarketOrder(), with stops given in pips
Read an indicatoriMA(), iRSI() return the value directlyiMA(), iRSI() return a handle; values are read with CopyBuffer()Indicator objects created once, read through their result series
Trade sizeLotsLotsVolume in units (lots can be converted with the symbol's settings)
Account modeHedging only: every trade is its own ticketHedging or netting: on netting, same-symbol trades merge into one positionHedged or netted
"Invalid stops" error13010016Reported in the cBot's Log
Where it runsMQL4 > Experts, AutoTrading onMQL5 > Experts, Algo Trading onAutomate, 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.

RouteNeeds .mq4 source?Needs coding?TargetsBest forWatch out for
Rewrite it yourself in MQL5 or C#YesYes, both languagesAnythingProgrammers, unusual logicTime; subtle differences in the table above
Hire a developerYesNo (you pay)AnythingComplex EAs, custom indicatorsCost and turnaround; you still have to check the result
Ask the seller for an MT5 versionNoNoWhatever the seller offersBought EAs with only an .ex4May not exist; cTrader versions are rarer
Rebuild in AlgoPuzzle (import, then export)Yes (.mq4, .mq5 or .cs, up to 512 KB)NoMT5, MT4 and cTrader from the same blocksRule-based EAs, fxDreema exportsCustom 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.

  1. 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.
  2. Import it. Open the builder, click Import and choose the file (or paste the code). A free account is needed. Details: Import a strategy.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. Export for the new platform. Click Export to MT5 for a .mq5 Expert Advisor or Export to cTrader for a .cs cBot; installation steps for both are in Export to MT5, MT4 and cTrader.
  8. 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.

StatusMeaningWhat to do
Imported exactlyRebuilt with blocks that do the same thingA quick look
Imported with a differenceMapped as closely as possible; a note says what differsDecide whether the difference matters
Not importedAffected trading, but has no AlgoPuzzle block, so it was left outRebuild it with other blocks, or accept that results will differ
Not neededNo effect on trading: chart drawing, comments, alertsNothing

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 EANo-code rebuild?Notes
Built-in indicators: moving averages, RSI, MACD, Bollinger Bands, ATR, Stochastic, ADX, Ichimoku, CCIYesSee Indicators and values
Comparisons, crosses, rising / falling, AND / OR / NOTYesSee Conditions
Fixed lot or lot from a % of the balanceYesBackground: position sizing
Stop loss and take profit in pipsYesBackground: stop loss vs. take profit
Trailing stop and break-evenYesBackground: trailing stop loss
Exit rule (close when a condition becomes true)YesThe CLOSE IF slot
Trading hours and daysYesSet on the rule
Custom indicators (iCustom)NoNeeds a programmer, or a rule rebuilt from built-in indicators
Multi-step logic: counters, flags, state carried between tradesNofxDreema or hand-written code can express this; AlgoPuzzle's rule slots can't today
Martingale or grid lot progressionNoWorth 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.

SettingKeep it identicalWhy
Symbol and timeframeYesDifferent bars, different signals
Date rangeYesPick a period you know the original's results for
Lot size and starting balanceYes%-risk sizing depends on the balance
Spread / modellingAs close as the platforms allowMT5'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 differenceWhat it looks like
Different price history between MT4, MT5 and cTrader serversA signal fires one bar earlier or later, or not at all
Spread and slippage modellingSlightly different entry and exit prices
MT5 netting accountTwo trades on the same symbol appear as one position
Stops managed by the EA instead of sent to the brokerAn 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.

StepRead
Choose the target platformMT4 vs MT5 vs cTrader: Which Should You Automate On?
Understand what an EA is made ofWhat Is an Expert Advisor (EA)?
Import the .mq4 / .mq5 / .cs fileImport a strategy (documentation)
Coming from fxDreemafxDreema Alternatives: Free No-Code EA Builders Compared
Backtest in the browserRunning a backtest and Reading backtest results
Export and install on MT5 or cTraderExport to MT5, MT4 and cTrader
Compare in the Strategy TesterHow to Backtest an EA in the MT5 Strategy Tester
Don't trust a too-good resultWhat Is Curve Fitting? and What Is Profit Factor?
Fix problems after going liveEA 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.

Import your EA and export it for MT5 or cTrader