Learn
MT4 vs MT5 for Expert Advisors: Which Platform Your EA Needs
At a glance
MT4 and MT5 Expert Advisors are separate programs. MT4 runs .ex4 files compiled from MQL4, MT5 runs .ex5 files compiled from MQL5, and a compiled file cannot be moved to the other platform. In our lab the same 28-line non-trading EA compiled unchanged in both editors; order handling is where the code differs. MetaQuotes lists netting accounts, a multi-threaded tester with real ticks and non-forex markets for MT5 only. Use the platform your EA version and your broker account actually support.
On this page

An Expert Advisor is built for one platform. An MT4 EA does not run in MT5, and an MT5 EA does not run in MT4. So the first question is not which platform is better. It is which version of the EA exists and which platform your broker account uses.
This guide compares MetaTrader 4 and MetaTrader 5 from the position of someone who wants to run an EA: file types, what changes in position handling and testing, and how to decide. It is not a general platform review and it ranks nothing.
Platform documentation was checked on 1 October 2026. The two-platform compile test is our own, from 21 September 2026. RoboXpert develops its own trading software, currently for MT5 and TradingView, and has a commercial interest in this subject. AI assisted with research and drafting. See our editorial disclosure.
An MT4 EA does not run in MT5
The two platforms use different programming languages and different program files. The table shows what you will see in a download or a product listing.
Scroll horizontally if needed
| MetaTrader 4 | MetaTrader 5 | |
|---|---|---|
| Language | MQL4 | MQL5 |
| Source file | .mq4 | .mq5 |
| Compiled program | .ex4 | .ex5 |
| EA folder in the data directory | MQL4/Experts | MQL5/Experts |
MetaQuotes’ MetaEditor help describes compilation as converting source code into “an executable program file (*.EX4 or *.EX5) that can be launched in a trading platform.” It adds that the executable is created “in its own format hiding the original program algorithm.”
Two consequences follow.
- Renaming does not convert. Changing
.ex4to.ex5changes the name, not the program. - A compiled file cannot be ported by you. It hides the source. If you hold only an
.ex4, the MT5 version has to come from whoever holds the source code.
When a product says “for MT4 and MT5,” it should mean two separately built and supported programs. Ask which one you are getting.
One source file, two platforms: what our test shows
A small program can be valid in both languages. On 21 September 2026 we compiled one 28-line EA in the MetaEditor of each platform. The file is byte-identical under both names; only the extension differs.
Scroll horizontally if needed
| Check | MetaTrader 4 | MetaTrader 5 |
|---|---|---|
| Source | RoboXpert_Setup_EA.mq4 | RoboXpert_Setup_EA.mq5 |
| SHA-256 of the source | 5e841f48…70fd6df8 | 5e841f48…70fd6df8 |
| Compiler result | 0 errors, 0 warnings | 0 errors, 0 warnings |
| Ran in terminal build | 1476 | 6182 |
| Observed | Status label, three timer callbacks | Status label, three timer callbacks |
The test ran on an Apple Silicon Mac with the official MetaQuotes packages. No broker account was connected and no order was sent. The download contains both files, both compiler logs and the checksums.
Why it worked: the program draws a label and counts timer events. It contains no trading functions.
What it does not show: that trading EAs are portable. Order handling is where the languages part ways. Compare the function that sends an order:
MQL4: int OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, ...)
MQL5: bool OrderSend(MqlTradeRequest& request, MqlTradeResult& result)
In MQL4 the call takes the order details as separate values and returns a ticket number, or −1 on failure. In MQL5 it takes a request structure and fills a result structure whose return code the program has to read. A migration article on MQL5.com lists further differences, including how indicator values, price series and account information are read. We did not port a trading EA for this guide.
Reader resource · ZIP
Compile the same file in both editors
The 28-line non-trading EA under both file names, our two compiler logs, checksums, instructions and an MIT licence. No order-sending code.
Download the probeMT4 vs MT5: what differs for an EA user
The rows below come from MetaQuotes’ platform comparison, read directly from the page on 1 October 2026. The last column is our explanation of why each row matters when you run an EA.
Scroll horizontally if needed
| Feature | MetaTrader 4 | MetaTrader 5 | Why it matters for an EA |
|---|---|---|---|
| Position accounting | Hedging | Netting or hedging | On a netting account all trades on a symbol merge into one position. The EA’s logic has to match the account |
| Strategy tester | Single thread | Multi-threaded, multi-currency, real ticks | Tests run differently, so a backtest from one platform is not the same experiment on the other |
| Pending order types | 4 | 6 | An EA that relies on an MT5-only order type has no direct MT4 equivalent |
| Order fill policy | Fill or Kill | Fill or Kill, Immediate or Cancel, Return | An MT5 EA has to handle a request that is filled only in part |
| Partial order filling | No | Yes | Same point: the position can be smaller than requested |
| Timeframes | 9 | 21 | A rule written for a timeframe that exists only in MT5 has no MT4 chart to run on |
| Supported markets | Forex | Forex, futures, options, stocks, bonds | Decides whether the instrument you want is available at all |
| Exchange trading, Depth of Market | No | Yes | Needed by strategies that read the order book |
| Symbols | 1,024 | Unlimited | Rarely a limit for a single EA |
“Supported markets” is MetaQuotes’ description of the platforms. What you can actually trade is the symbol list of your broker account.
The first row deserves the most attention. An EA written for hedging accounts can misbehave on netting, because a second order changes the existing position instead of opening a new one. Our hedging vs netting guide walks through one order sequence on both.
Results do not carry over between versions
An MT4 version and an MT5 version of “the same” EA are two programs, tested in two different testers and run on accounts with possibly different position accounting. A track record belongs to the version, settings and account that produced it.
Before relying on published results, ask three questions:
- Which platform and which product version produced this record?
- Is the version I would run the same one, or a later port?
- Was the backtest made in the MT4 or the MT5 tester, and with which data model?
Our guides on verifying EA results and on backtest vs live trading explain what such a record can and cannot establish.
Which platform should you use?
Start from what is fixed. In most cases the platform is decided for you.
Scroll horizontally if needed
| Your situation | Sensible starting point |
|---|---|
| You already own a compiled EA | The platform it was built for. Ask the seller whether a version for the other platform exists |
| Your broker offers only one platform | That platform, or a different account. An EA cannot bridge the gap |
| The EA exists for both | The version the seller maintains and whose results you can inspect |
| You want instruments beyond forex | Check MT5 first; MetaQuotes lists forex only for MT4 |
| You are building a new EA | MetaQuotes’ comparison shows the wider tester and market support on MT5. MT4 remains relevant when an existing EA or a broker requires it |
| You run several EAs on one account | Check the account’s position accounting before anything else |
If none of these settles it, the deciding factor is evidence, not features: choose the version whose behaviour you can test on a demo account under your broker’s conditions. Our EA buying checklist covers that step.
Running both platforms side by side
MT4 and MT5 are separate applications with separate data folders. Our lab ran both on the same Mac, each with its own MQL4 or MQL5 folder. Keep each program file in the folder of the platform it was built for.
What stays the same on both: the EA runs only while its terminal is open and connected, it needs permission to trade, and a VPS changes availability, not results. See what an Expert Advisor is, MetaTrader on Mac and MetaTrader VPS vs Windows VPS.
Frequently asked questions
Can I convert an .ex4 file to .ex5?
No. A compiled file hides its source, and the two platforms use different languages. An MT5 version has to be built from source code, which means by the developer or by someone the developer gives the source to.
Is MT5 better than MT4 for Expert Advisors?
MetaQuotes’ comparison lists more capabilities for MT5: netting and hedging, a multi-threaded tester with real ticks, more order types and more markets. That makes MT5 the wider platform. It does not make a particular MT5 EA better than a particular MT4 EA. Judge the program and its evidence.
Is MetaTrader 4 being discontinued?
We found no current MetaQuotes statement to cite. Trade press reported in January 2018 that MetaQuotes would stop issuing new MT4 licences to new brokers while existing brokers could keep using and receiving support for the platform; see Finance Magnates. Treat that as a dated secondary report. Whether MT4 is available to you depends on your broker.
Will the MT4 and MT5 versions of an EA trade the same?
Not necessarily. They are separate programs running on platforms with different order handling, and possibly on accounts with different position accounting. Compare them on demo accounts before assuming identical behaviour.
Sources & further reading
- MetaQuotes: comparison of the MetaTrader 5 and MetaTrader 4 platforms
- MetaEditor Help: compilation and executable files
- MetaTrader 4 Help: Expert Advisors
- MetaTrader 5 Help: Expert Advisors and custom indicators
- MQL4 Reference: OrderSend
- MQL5 Reference: OrderSend
- MQL5.com: Migrating from MQL4 to MQL5 (Sergey Pavlov, 2010)
- Finance Magnates: Metaquotes will no longer sell its MT4 trading platform (12 January 2018)


