Ready to go further
Next: compare the two platforms
See how MT4 and MT5 differ in files, orders and testing before you pick one to run an EA on.
What is included
- What it is, in plain words
- The formula or mechanism, with exact arithmetic
- How it hits grid, martingale and DCA bots
- A check you can run before you switch a bot on
Who it is for
- People who run or plan to run a trading bot
- Anyone reading a backtest or a bot sales page
- Readers who want the numbers, not the pitch
- Not advice, and not a signal service
Key facts
- An MT4 EA is an expert advisor built for MetaTrader 4 and written in that platform's own language. An MT5 EA is a different file and will not load on MT4.
- The files are a source file (.mq4), a compiled file (.ex4), and often a settings file (.set). Only the compiled file is needed to run. The source is needed to read or change the rules.
- MT4 testing is built on bars and an assumed price path inside each bar. A test with one fixed spread can flip a result: in the made-up example below the same EA shows 240 pips at 1.0 pip spread and -210 at 2.5 (calculated by us on 29 Oct 2026, exact).
- Which account types and order rules apply is set by the broker, and MT4 and MT5 handle positions differently. Check yours before you trust a test.
- Compare the platforms on MT4 vs MT5, then follow install an EA on a demo account.
What an MT4 EA is
MetaTrader 4, called MT4, is a trading platform that many retail brokers offer. It lets a program, called an expert advisor or EA, run on a chart and place trades. An MT4 EA is simply an EA written and compiled for that platform. It follows the same loop as any other: read the prices, test the rules, check the guards, send or change an order, then wait. The forex EA page describes that loop in detail.
The word MT4 matters because platforms do not share EAs. A program written for MT5 will not open on MT4, and the other way round. The two use similar but different languages, and the platforms handle orders and testing differently. If you are shown an EA, the first question is which platform it is for.
MT4 against MT5 in short
- Different files. MT4 uses .mq4 and .ex4. MT5 uses .mq5 and .ex5.
- Different order handling. MT4 works with individual orders. MT5 can net positions or hedge them, depending on the account type. Details vary by broker.
- Different testers. MT5 has a tester that can use real tick data and several cores. MT4 has an older tester. The full comparison is on MT4 vs MT5.
- Different availability. Which one your broker offers is the broker's choice. Some offer both.
The files an MT4 EA uses
When you look inside the MT4 data folder you find a few kinds of files. Knowing them tells you what you have been given.
- The .mq4 file. The source, as readable text. Anyone with it can read the rules and change them. It sits in the Experts folder of the data folder.
- The .ex4 file. The compiled program. It is what the platform runs. It cannot be read back into rules, so an EA given as only an .ex4 is a closed box. You can test it, but not see why it trades.
- The .set file. A saved list of the settings, called inputs. It is the lot size, the stop, the hours and so on. Two people with the same EA and different .set files run different bots.
- Include and library files. Shared code the EA calls. If one is missing the EA may refuse to load. The Experts tab of the platform log says so.
To load an EA, the files go in the right folders and the platform must be allowed to run automated trading. The steps and the checks are in install an EA.
Where MT4 testing falls short
The MT4 strategy tester replays past prices through your EA. It is useful, but it does not copy live trading. Four limits matter most for an EA.
- Price data inside a bar is built, not recorded. MT4 history is stored as bars. The tester fills in the ticks between the open and close by a fixed method. The report shows a modelling quality figure that says how much of the test used better data. A low figure means the path inside bars was guessed. An EA that trades inside bars, with tight stops, is the most affected.
- The spread is fixed. The tester usually charges one spread for the whole run, taken from a setting or the spread at the time of the test. Real spreads change over the day, as the figure below shows.
- No slippage unless you add it. The tester fills at the price it shows. Live orders can fill at a worse price. See slippage.
- History quality is up to you. History downloaded from a broker may have gaps. A test over a gap is a test over a made-up line.
Worked example: one EA, four assumed spreads
This is a made-up EA, not a real one. It earns 1.8 pips a trade before spread, over 300 trades. The only thing that changes in the table is the fixed spread the test assumed.
| Assumed spread (pips) | Net per trade (pips) | Net over 300 trades (pips) | Result |
|---|---|---|---|
| 1.0 | 0.80 | 240 | Ahead |
| 1.5 | 0.30 | 90 | Ahead |
| 2.0 | -0.20 | -60 | Behind |
| 2.5 | -0.70 | -210 | Behind |
At 1.0 pip the EA looks fine at 240 pips. At 2.0 pips it is behind by 60. Nothing about the rules changed. Calculated by us on 29 Oct 2026, exact. Now look at the figure. If the real spread is 1.0 pip most of the day but 3.0 at news time and 6.0 at rollover, a test with one number gets the quiet hours right and the busy hours wrong. For an EA that trades at news, that is the part that counts. The spread page covers this in more detail.
How to test an MT4 EA sensibly
- Use the best history you can get, and read the modelling quality figure in the report. Treat a low figure as a warning.
- Run the test at more than one spread, including one wider than usual. If the result flips, the edge is thin.
- Add commission if the account charges it. The tester does not always include it unless you set it.
- Keep part of the data for a second test with the settings fixed. See forward testing.
- Then run it on a demo account, and compare the live trades with the test. The backtesting page gives the whole sequence.
What this page does not tell you
It does not say MT4 is better or worse than MT5, or that any MT4 EA makes money. The EA and all numbers are made up. How your broker handles orders, spreads and account types varies, so check its terms.
Keep Going
Related Tools and Guides
Keep exploring
FAQ
Frequently Asked Questions
What is an MT4 EA?
It is an expert advisor written and compiled for the MetaTrader 4 platform. It runs on a chart and places trades by fixed rules.
Can I run an MT5 EA on MT4?
No. The files and the language differ. You need a version written for the platform you use.
What is the difference between .mq4 and .ex4?
The .mq4 file is the readable source. The .ex4 file is the compiled program the platform runs. With only an .ex4 you can test an EA but you cannot read its rules.
Why can an MT4 test be misleading?
MT4 builds the price path inside bars, uses a fixed spread unless set otherwise, and has no slippage by default. The report's modelling quality figure shows how much to trust it.
Do I still need to test on a demo account?
Yes. A demo shows live spreads, fills and your platform setup, which the tester cannot. It still differs from a live account, so treat it as a check, not proof.
Are the numbers on this page real?
Example numbers are made up to show how the maths works, and the page says so. A figure only counts as exact when the page says it was calculated on a stated date. Nothing you enter in a calculator leaves your browser.
Can I use this to decide whether to run a bot?
It can show whether a bot's numbers hold together and how much an account can lose. It cannot say what the market will do, and it is not advice. Use it to ask better questions, then read the terms of your own broker or exchange.
Is this financial advice?
No. It is general education. The numbers are made up and your broker and platform setup will differ.
Know the Risk Before You Run It
Free calculators and guides, added every week. Leave your details and we will email you when new ones go up.
Trading carries a risk of loss