To backtest an Expert Advisor in MT4, load the price history in the History Center (F2), open the Strategy Tester (Ctrl+R), choose the EA, symbol, period, model and spread, press Start and read the Report tab. A good report on its own proves little: the MT4 tester ignores floating spread, execution speed and slippage, and if many settings were tried, the best one may simply be the luckiest.
Below we go through the test step by step, then cover the questions that matter after it: why a backtest can look too good, how to check it on data the optimizer never saw, and why a live record counts for more. There are no magic numbers here. Where a figure appears, it comes from a named source or from a calculation we show and mark as ours.
Step 1: Load the Price History
A backtest is only as good as the history behind it. In MT4 go to Tools → History Center or press F2, select a symbol and press Download. The terminal loads M1 data and builds the other timeframes from it.

Three things to know about this data:
- It may not be your broker's data. The Download button uses MetaTrader's history data server, and the MT4 Help warns that this data can differ from the history on the broker's trade server.
- You can import your own. The History Center's Import button accepts CSV, PRN, TXT, HTM and HST files, for example history from your broker.
- Check that the data is there. If the tester finds no history for a symbol and period, it downloads only the last 512 bars. Look at the test dates and the number of bars before you trust the result.
Step 2: Set Up the Strategy Tester
The EA must be compiled and sit in the terminal's Experts folder. If it doesn't appear in the list, see How to Install and Run an EA on MT4. Then open the tester with View → Strategy Tester or Ctrl+R, and on the Settings tab fill in these fields:

- Expert Advisor: the EA to test.
- Symbol: the pair. Use one the EA was built for. The tester trades only the tested symbol, so an EA that trades several pairs can't be tested as a whole here.
- Model: how the tester rebuilds price movement (see the table below).
- Period: the timeframe the EA runs on.
- Spread: see the note below the table.
- Use date: tick it to set From and To dates. Pick a period that covers different market conditions, and note which part you will keep for the out-of-sample test described later.
- Expert properties: on the Testing tab set the initial deposit and position types (Long, Short or both). On the Inputs tab set the EA's parameters. In the Value column you set what a single test uses, while Start, Step and Stop matter only for optimization.

Turn the EA's money management off and use a fixed lot. If the lot grows with the balance, later trades outweigh earlier ones and two tests become hard to compare. With 0.10 lot on EUR/USD, one pip is worth $1, which keeps the arithmetic simple (see What Is a Pip in Forex?).
Press Start. With Visual mode on, the test plays on a chart, which is a good way to see how the EA actually trades. The Results, Graph and Report tabs appear after the test.
Which Model to Choose
| Model | How it works | Use it for |
|---|---|---|
| Every tick | Uses all available lower timeframes and fills the gaps by interpolation | Final tests of EAs that trade inside a bar |
| Control points | Uses the nearest lower timeframe | Rough estimates and optimization |
| Open prices only | Works on completed bars only | EAs that act only at the open of a new bar |
The name "Every tick" is misleading. With standard history these ticks are generated from minute bars, not recorded. MetaQuotes advises against this model when lower timeframes don't cover the whole test period, because the result won't be accurate.
The Spread Field
MT4 history holds only bid prices, so the tester adds a spread itself, and one value applies to the whole test. "Current" takes the spread at the moment you press Start. Run the same test on a quiet Tuesday and during a late Friday session and you may get two different results. Enter a number instead, in points: on a 5-digit quote, 19 points = 1.9 pips. Use a figure typical for your broker. If you don't know the basics yet, read What Is Spread in Forex?
Step 3: Read the Report
Here is a report from an older EUR/USD test, and what its main lines mean according to the MT4 Help:

| Line | In this report | What it means |
|---|---|---|
| Modelling quality | 90.00% | How well the ticks were modelled from lower timeframes |
| Spread | Current (19) | One spread for the whole test, 1.9 pips |
| Total trades | 34 | The size of the sample |
| Profit factor | 1.51 | Gross profit ÷ gross loss: 746.77 ÷ 493.14. A value of 1 means the two are equal |
| Expected payoff | 7.46 | Average result per trade: 253.63 ÷ 34 |
| Absolute drawdown | 48.82 | The largest loss below the initial deposit |
| Maximal drawdown | 256.58 (2.51%) | The largest fall from an equity peak to the low after it |
Modelling quality shows how the ticks were built, not how good the EA is. By the formula MetaQuotes published, bars modelled from minute data get a weight of 0.9, which is why M1 history tops out at 90%. With "Open prices only" the field shows n/a, and that's normal. Traders who load tick data with third-party tools report figures up to 99%. That can improve the price path inside a bar, but it does nothing about execution or overfitting. The MT4 Help doesn't define Mismatched charts errors, but traders usually treat a non-zero value as a sign of inconsistent history and download the data again.
There is no universal "good" profit factor or drawdown, and we won't invent one. A profit factor is measured on this sample, at the tester's costs, and an optimizer can push it up by chance. A maximal drawdown is the worst fall that happened in this test, not the worst that can happen. For what a drawdown does to an account, see Money Management in Forex.
Sample size changes how much a number can tell you. In this report 27 of 34 trades won, or 79%. With 34 trades, a 95% confidence interval for the win rate runs from about 63% to 90%. With 340 trades and the same 79%, it would run from about 75% to 83% (our calculation, Wilson interval). There is no fixed trade count that makes a test valid, but the fewer the trades, the wider the range of what the numbers can mean.
What the MT4 Tester Leaves Out
The tester models swaps, margin requirements and pending orders, but not everything a real account meets:
- Floating spread. One spread for the whole test. Around news and at the daily rollover, real spreads widen.
- Execution speed. MetaQuotes describes the tester as having no delays in trade operations, and its Settings tab has no delay field.
- Slippage. Trades are processed without it, so every fill is cleaner than a live account can count on.
How much this matters depends on how much an EA earns per trade. A simple illustration (our arithmetic, not data from a real EA): suppose real trading costs an extra 0.5 to 2 pips per trade.
| Extra cost per trade | EA averaging 5 pips | EA averaging 50 pips |
|---|---|---|
| 0.5 pip | −10% | −1% |
| 1 pip | −20% | −2% |
| 2 pips | −40% | −4% |
So a scalper's backtest says far less than a long-term EA's. A cheap stress test is to raise the Spread field and run the test again: if the result falls apart, the EA has little room for real costs.
MT5 gets closer. Its tester can use "Every tick based on real ticks", and it has fixed and random execution delay settings (see MT4 vs MT5). It is still a test, though, not a live account.
Why the Best Backtest May Be the Luckiest
Most EAs have inputs: periods, levels, filters. The tester's Optimization option runs the EA again and again over the Start, Step and Stop values you set and ranks the results. It's a useful tool with a built-in trap. An optimizer returns the best result it found. It can't tell skill from luck.
That trap is called overfitting, or curve fitting: settings tuned to past noise rather than to a pattern that repeats. The test looks excellent because the settings were picked to fit that exact stretch of history.
The mathematicians Bailey, Borwein, López de Prado and Zhu put numbers on it in Pseudo-Mathematics and Financial Charlatanism (Notices of the AMS, 2014). They take strategies with no real edge and ask how many independent trials it takes before the best one reaches a Sharpe ratio of 1 in the test, while the expected Sharpe ratio afterwards is 0. The Sharpe ratio measures return against its volatility. The MT4 report doesn't show it, but the idea carries over.
| Data available | Trials until luck looks like skill |
|---|---|
| 2 years | 7 |
| 5 years | 45 |
That's not many. Seven on/off options already give 27 = 128 combinations. Three inputs with ten values each give 1,000 passes. If those passes were independent, the paper's formula says you would need about 6.8 years of data for 128 trials and about 10.6 years for 1,000 just to keep the best lucky Sharpe at 1 (our calculation using equation 3.2, which also gives 1.9 years for 7 trials and 5.0 years for 45).
Read these as a warning, not as a limit. Neighbouring settings aren't independent, so an optimizer's real number of trials is lower than its pass count, and the paper calls the independence assumption quite conservative. On the other hand, it also says that a test longer than this minimum can still be overfit.
The authors' main conclusion is simple: a backtest that doesn't report the number of trials makes the risk of overfitting impossible to assess. So when someone shows you a beautiful report, ask how many settings were tried to get it.
Three Checks Against Overfitting
- Nearby settings work too. Move each input a little up and down. If the result holds across the neighbourhood, the EA is less likely to depend on one lucky value. If only one exact value works, be suspicious.
- It holds on unseen data. Test the fixed settings on a period that played no part in choosing them. This is the out-of-sample test below.
- Few parameters, many trades. The more inputs an EA has, the more ways it can fit noise. The more trades a test has, the harder it is for luck alone to explain the result.
Out-of-Sample Testing in MT4
MT4 has no special mode for this, but Use date is all you need:
- Split your history in two. The older part is in-sample and the newer part is out-of-sample. Decide on the split before you look at any results.
- Run the optimization with Use date set to the older part only, and choose your settings.
- Untick Optimization, enter the chosen values in the Value column and run one test on the newer part.
- Compare the two reports: the average result per trade, the drawdown, the number of trades. A sharp drop in the second period is the classic sign of overfitting.
The MT5 tester does this split for you: its Forward mode takes 1/2, 1/3, 1/4 or a custom part of the period and always uses the latest part for the forward test.
An out-of-sample period works only once. If you go back, change the settings and test on it again, it is no longer unseen, and you have added another trial. The paper makes the same point about hold-out tests: they don't account for how many attempts came before.
If you bought the EA, someone else ran the optimization. You usually can't know how many trials went into the default settings, so ask. Then test those settings on your broker's data, and pay most attention to the period after the settings were published. For the seller, that period can't have been part of the fitting.
Why Live Results Count for More
A backtest is the fastest way to reject an EA, but a weak way to confirm one. A live account fixes the two biggest gaps at once. It runs on real spreads, delays and slippage, and every day after the settings were frozen is out-of-sample by nature.
A sensible order is backtest, out-of-sample test, demo, then a small live account, or a verified live record from the seller. When you read a live record, the same logic applies:
- Is it third-party verified, and is it a real-money account rather than a demo?
- How long has it run, and how many trades does it have? A few good months prove little.
- When were the settings fixed? Results from before that date may be fitted too.
- Is it the only account? Showing the best of ten accounts is the same trap as showing the best of ten backtests.
That's why on ForexStore each robot's page links to its live account, and our ranking of forex robots is built from live trading results rather than backtests. A live record is the stronger evidence, but it isn't a promise: past results don't guarantee future ones.
FAQ
What modelling quality do I need in an MT4 backtest?
There is no universal minimum. With M1 history the maximum is 90%, and "Open prices only" shows n/a, which is normal for an EA that trades on completed bars. Modelling quality describes how the ticks were built. It says nothing about overfitting or execution, so a high figure alone doesn't make a test reliable.
What is a good profit factor in a backtest?
There is no universal figure. A profit factor is gross profit divided by gross loss, and a value above 1 means the test made money on paper. How much it means depends on the number of trades, the costs used in the test and how many settings were tried to get it.
What is overfitting in a backtest?
Overfitting means settings are tuned to past noise rather than to a pattern that repeats. Bailey and co-authors (Notices of the AMS, 2014) show that with 2 years of data about 7 independent trials are enough for the best one to reach a Sharpe ratio of 1 in the test while the expected result afterwards is 0. With 5 years, about 45.
Why do live results differ from a backtest?
The MT4 tester uses one spread for the whole test and has no execution delay or slippage, while a live account meets all three. If the settings were overfitted, the pattern they matched in the past may not exist in new data either.
The Bottom Line
- A backtest takes history (F2), the tester (Ctrl+R), the right model and a spread you set yourself.
- Modelling quality describes the ticks, not the EA. Don't use it, or the profit factor, as a pass mark.
- The MT4 tester ignores floating spread, execution speed and slippage, so EAs with a small profit per trade suffer most in live trading.
- The best of many settings may be the luckiest: about 7 independent trials with 2 years of data, about 45 with 5.
- Check nearby settings, test on unseen data, prefer few parameters and many trades, and ask how many trials were run.
- Then a demo, and then a verified live record.
New to all this? Start with our step-by-step guide to start trading.
Sources: MetaTrader 4 Help, Strategy Testing and History Center; MetaTrader 5 Help, Testing; MetaQuotes articles What the Numbers in the Expert Testing Report Mean and Testing Features and Limits in MetaTrader 4; MQL4 Reference, Testing; Bailey, Borwein, López de Prado and Zhu, Pseudo-Mathematics and Financial Charlatanism, Notices of the AMS, 2014.
This article is educational and is not investment advice. Trading leveraged products involves risk of loss.