Most EA sellers can show a smooth equity curve rising steadily from left to right, yet many of those EAs lose money in live trading. The backtest is usually genuine, but it has been run in a way that hides the problems.
This guide walks through how to backtest an Expert Advisor in MetaTrader 5 so the result tells you something real, and what to look for when someone else shows you their numbers.
What a Backtest Can and Cannot Tell You
A backtest replays historical prices and lets the EA trade them as if they were live. It is good at answering:
- Does the EA do what its description says?
- Roughly how often does it trade, and how large are its losses?
- Does it fall apart in certain market conditions?
It is bad at answering “how much will I make next month?” History does not repeat exactly, and live trading adds slippage, requotes, variable spreads and server delays that a tester only approximates. Treat a backtest as a way to find reasons to reject an EA, not as proof that it works.
Step 1: Get Good Data
Open the Strategy Tester (Ctrl+R in MT5). Before choosing settings, make sure your broker’s history for the symbol is downloaded. In MT5, the tester pulls history from your broker’s server automatically, but brokers differ in how far back they go and how clean the data is.
If you plan to trade an EA with a particular broker, backtest on that broker’s data. Gold on one broker can have different contract sizes, digits and spreads than on another, and an EA tuned for one may behave differently on the other.
Step 2: Choose the Right Modelling Mode
MT5 offers several modes. The choice matters more than anything else:
- Every tick based on real ticks: uses the broker’s recorded tick history, including real spreads. It is the slowest mode and the most accurate. Use this for anything that scalps, uses tight stops, or trades on M1–M15.
- Every tick: generates synthetic ticks from M1 bars. Reasonable for swing systems, unreliable for scalpers.
- 1 minute OHLC: only four price points per minute. Fine for quick checks of H1+ strategies.
- Open prices only: very fast, only valid for EAs that explicitly act on bar open.
A scalping EA tested on “Open prices only” or “1 minute OHLC” can show a fantastic result that is pure fiction, because the tester never sees the price going against the trade inside the bar. If a seller will not tell you which mode they used, assume it was not real ticks.
Step 3: Set a Realistic Spread and Costs
With real-tick modelling, spreads come from history. With other modes you set a spread manually. Pick something at or above what you will actually pay, especially around news and rollover, when spreads widen sharply.
Do not forget commission. On raw-spread accounts it is charged per lot and can be the difference between a profitable scalper and a losing one. Set it in the symbol’s tester settings or account for it when reading results.
Step 4: Test Over Enough Time, and the Right Time
A three-month backtest proves almost nothing. Markets go through trending phases, ranging phases, high- and low-volatility regimes. A useful test covers:
- At least two to three years for intraday systems, longer for swing systems.
- Different market conditions, for example a strong trend year and a choppy year.
- Stress events such as major central-bank surprises or flash moves.
Then use MT5’s Forward setting. It splits your date range so the EA is optimized on the first part and then tested on the later part it has never seen. If the forward segment looks nothing like the back segment, the settings were curve-fitted.
Step 5: Read the Report Like a Sceptic
Net profit is the least useful number on the report. Look at these instead:
- Maximal drawdown (equity): the worst peak-to-trough fall including open trades. Balance drawdown alone can hide huge floating losses.
- Profit factor: gross profit ÷ gross loss. Below 1.2 leaves little room for live costs. Above 3 over thousands of trades deserves suspicion.
- Total trades: fewer than 100 trades is not a sample, it is an anecdote.
- Largest loss vs average win: if one loss wipes out 40 wins, the EA is taking small gains while carrying a large hidden risk.
- Consecutive losses: can you sit through that streak emotionally and financially?
Then open the Graph tab and look at the equity line (not just balance). If balance climbs smoothly while equity dips deep below it, the EA is holding losing trades open and waiting for them to come back. That is typical of grid and martingale systems, and it is how they eventually blow up.
Step 6: Run a Few Robustness Checks
An EA that only works with one exact set of inputs is fragile. Try:
- Nudging settings: change a moving average period from 20 to 18 or 22. A sound system degrades gradually; a curve-fitted one collapses.
- Different symbols or brokers: not every EA should work everywhere, but one that only works on one broker’s data for one year is a red flag.
- Higher spread: add 20–50% to the spread. If profit vanishes, live trading will be tougher than the test suggests.
- Different start dates: starting the test a month later should not turn a winner into a loser.
Step 7: Demo, Then Small Live
After a backtest you are happy with, run the EA on a demo account for at least a few weeks, ideally on a VPS so it runs continuously. Compare demo trades to what the backtest would have done over the same dates. Big differences point to execution issues, timezone mismatches or logic that depends on bar data the tester handles differently.
Then go live with the smallest size your broker allows. Demo fills are often better than real fills, and some brokers’ demo servers use different spreads. Only scale up once live behaviour matches demo.
Red Flags in Someone Else’s Backtest
- No modelling quality or mode mentioned.
- Only the balance curve shown, never equity.
- A test period of a few months, or one that conveniently ends just before a major market event.
- Near-perfect win rates (95%+) with no explanation of how losers are handled.
- Lot sizes that grow sharply after losses (martingale) or many positions open at once (grid).
- Results on “Open prices only” for an EA that trades on M1 or M5.
None of these automatically means the EA is bad, but each is a reason to run your own test before trusting anything.
A Simple Backtesting Routine
- Download history and confirm the symbol’s contract specification.
- Backtest 2–3+ years on real ticks with realistic costs.
- Read equity drawdown, profit factor, trade count and worst loss.
- Run a forward split and a few robustness tweaks.
- Demo for several weeks, then trade live at minimum size.
It takes longer than downloading an EA and pressing play. It is also the difference between learning about a bad EA in the tester and learning about it with your own money. Every EA we share in our free Expert Advisors section should go through this routine before you trust it, and if you size each trade with our risk calculator, a bad week stays a bad week rather than becoming a blown account.
Backtest and demo results do not guarantee future performance. This article is educational and is not financial advice. See our risk disclaimer.
