Guides · · 7 min
How to Backtest a Forex EA in MT4 Without Fooling Yourself
A step-by-step guide to the MT4 Strategy Tester: the settings that matter, how to read the report and how to avoid a flattering backtest.

To work out how to backtest an EA in MT4, open the Strategy Tester, pick the robot, symbol and timeframe, choose the Every tick model, set a date range and a realistic spread, then press Start. That part takes minutes. The real work is making sure the history and settings are honest enough for the result to mean anything.
The short version
- A backtest shows how a set of rules would have traded past prices. It doesn't prove the robot will make money.
- Use the Every tick model with complete one-minute history, unless the EA only acts on bar opens.
- MT4 uses a single spread for the whole test by default, so enter one that reflects your real trading costs.
- Read the drawdown and the trade count before you look at the profit figure.
- Keep some data back for an out-of-sample test, then run the EA on a demo account.
What can a backtest tell you?
A backtest replays historical prices through an expert advisor and records the trades it would have placed. Used well, it can quickly rule out a poor idea, reveal how deep the losing runs go and show whether the logic matches what the seller describes.
It can't show how a robot will behave in a market that hasn't happened yet, and it doesn't reproduce your broker's fills. That gap is why vendor screenshots deserve caution. Of the 230 robots rated in our archive, the average score was 4.35 out of 10 and 125 scored below 4.5, and plenty of them came with impressive-looking test curves. Our guide on whether forex robots work covers the bigger picture.
How to backtest an EA in MT4, step by step
Install the robot first: it must be compiled and sitting in the platform's Experts folder before it appears in the tester. If it isn't there, follow our guide on how to install an EA on MT4. Then work through these steps. Labels can vary slightly between builds.
- Update your history. Open the History Center (F2), select the symbol and download data for the timeframes you need, including M1.
- Open the MT4 Strategy Tester from the View menu or with Ctrl+R.
- Select the Expert Advisor, symbol and period. Use the settings the robot is designed for.
- Choose the model. Every tick is the default choice for most robots. See the table below.
- Tick Use date and set the From and To dates. A test that covers trending, ranging and high-volatility periods tells you more than a single good year.
- Set the spread. Enter a value in points that reflects what your broker charges at the times the EA trades, plus an allowance for commission if you pay it separately.
- Open Expert properties. Set the starting deposit and currency, whether the robot can trade long, short or both, and its inputs. Match your intended account size and lot sizing.
- Leave Optimization off for the first run, then press Start.
- Check the Journal, Report and Graph tabs. Errors in the Journal can invalidate the whole run.
Which testing model should you use?
| Model | How it works | Best for |
|---|---|---|
| Every tick | Builds price movement from the lowest timeframe available. MetaTrader calls it the most accurate model and the most resource-hungry. | Final tests, and any EA that uses tight stops or acts within a bar |
| Control points | Uses the nearest lower timeframe, or templates if that data is missing. Results are rough estimates. | Quick screening and optimisation runs, not final judgement |
| Open prices only | The fastest model, which works from bar opens. | EAs that only make decisions on a completed bar |
Every tick still isn't a recording of the real market. MT4 builds the ticks from lower-timeframe bars, so a scalper can look far better in testing than it does live. The order of highs and lows inside a one-minute bar is only an estimate.
The settings that flatter a backtest
Most misleading backtests aren't faked. They're just built on generous assumptions.
- Spread. MT4's history holds Bid prices only. By default, the tester takes the symbol's spread when the test starts and uses it for the full run, so news spikes and thin overnight sessions aren't reflected.
- Slippage. The test fills at modelled prices, with no stop that jumps past its level on a fast release.
- Gaps in the history. Missing one-minute data forces the tester to guess. Look for the modelling quality and mismatched chart errors in the report.
- Compounding. A robot that scales lots with balance can show an enormous final profit that would never survive real liquidity or your nerve.
Costs matter more than most people expect. Here's a simple illustration, not a real result, for a robot placing 1,000 one-lot EUR/USD trades, with each pip worth about $10:
| Assumed cost | Net pips per trade | Result over 1,000 trades |
|---|---|---|
| 1-pip spread in the test | 3 | $30,000 |
| 2 pips of real spread and slippage | 2 | $20,000 |
| 3 pips of real spread and slippage | 1 | $10,000 |
| 4 pips during fast or thin markets | 0 | $0 |
Before you trust any figure, rerun the test at a wider spread. A robot that collapses after a small increase has very little edge to spare.
How to read the Strategy Tester report
MetaTrader's guide to tester results defines each field. These are the ones to check first:
| Field | What it means | What to look for |
|---|---|---|
| Modelling quality | The quality of the modelled ticks; n/a in Open prices only mode | Around 90% is the usual target on Every tick with sound M1 data, and is no guarantee of real tick accuracy |
| Mismatched chart errors | A sign that the history is incomplete or inconsistent | Zero, or redownload the data and retest |
| Total trades | The size of the sample | Dozens of trades over ten years prove very little |
| Profit factor | Gross profit divided by gross loss | Above 1 is needed. A very high figure often signals over-fitting |
| Expected payoff | Average profit or loss per trade | Must comfortably cover real costs |
| Maximal drawdown | The largest fall from an equity peak to the next low | Could you sit through it? Expect worse live |
| Consecutive losses | The longest losing run and its cost | Does your risk per trade survive it? |
Our archive piece on coping with drawdowns in forex is useful here, and risk/reward and win ratio explains why a high win rate means little alone. A smooth, rising equity curve with almost no dips is a warning sign, not a selling point. It's often what a martingale-style system looks like until the one trade that wipes it out.
How to avoid curve fitting
Optimisation tries thousands of input combinations and keeps the best. Do that enough and you'll find settings that fit the noise in old data perfectly and fail on anything new. This is curve fitting, and it's the commonest way to fool yourself.
- Split the data. Optimise on an earlier period, such as the first two-thirds of your history, and leave the rest untouched.
- Run the out-of-sample test once. Test the chosen settings on the untouched period. If you then re-tune and retest, that data has stopped being unseen.
- Prefer broad plateaus. If neighbouring input values also work, the idea is sturdier than a single sharp peak.
- Keep inputs few. Every extra setting gives the optimiser another way to fit the past.
- Test other pairs and periods where the logic should still hold.
MT5 builds this into its tester. Its forward testing option sets aside the latest part of the period, and its "Every tick based on real ticks" mode uses tick data collected by brokers. If you have a choice of platform and the EA is available for both, that's a real advantage.
Before you go live
A clean backtest earns a robot a place on a demo account, not your money. Run it forward for long enough to see a good number of trades, ideally on the same broker and account type you'd use live. Compare the demo fills with the backtest for the same period. Then, if you continue, start small. If you can't rerun a seller's numbers yourself, treat them as marketing. Our robot reviews show how often the claims and the results part ways. Automated trading carries a real risk of loss, and past results, simulated or live, don't guarantee future returns.
FAQ
How much history do I need to backtest an EA?
Enough to cover different market conditions and produce a meaningful number of trades. Several years is a sensible starting point for most robots, while a low-frequency EA needs longer because it trades less often.
Why does my MT4 Strategy Tester show 'n/a' for modelling quality?
MT4 shows n/a when you use the Open prices only model. It can also appear alongside mismatched chart errors when history is missing, so redownload the data in the History Center and run the test again.
Can I backtest a forex robot without the source code?
Yes, as long as you have the compiled file. Some commercial robots block tester use or limit it by licence, so check with the vendor if yours won't run.
Why are my live results worse than the backtest?
Live trading adds variable spreads, slippage, requotes and latency that a test doesn't fully model. Over-optimised settings also tend to fade once the market moves on from the data they were tuned on.