How to Backtest a Forex Robot (EA) Before You Risk Real Money — a Step-by-Step Guide
Finding a forex robot is the easy part: marketplaces, forums and vendor sites offer hundreds of expert advisors, and in our 24-broker review most brokers explicitly allow them to run. The hard part starts before the first real trade — checking whether the strategy behind that robot actually worked in the past, and under which conditions. That check is the backtest, and doing it properly is the difference between an informed decision and a coin flip.
This guide walks through the whole backtesting workflow for a forex EA: what to prepare, how to run the Strategy Tester in MT4 and MT5, which numbers in the report actually matter, and the seven mistakes that make a losing strategy look profitable. It is written for anyone running an expert advisor manually or buying one — and every broker-related number quoted here comes from our published 24-broker review, so you can verify it on the broker's own page.
Why the backtest comes before everything else
A robot is a strategy in code. Before you trust that code with money, you want evidence that the rules inside it — entries, exits, lot sizing, filters — produced acceptable results on historical price data, and that the results did not depend on two lucky trades. The backtest is the fastest way to get that evidence: years of data can be replayed in minutes, and a bad idea shows itself just as fast as a good one.
The order we recommend is fixed: backtest first, then a demo period, then a small live account, and only then scaling. If you are at the very start of the journey, our guide to trading bots explains the ecosystem, the getting started with your first trading bot guide covers the first weeks in practice, and the ultimate guide to forex robots maps the different robot types you may be testing.
What you need before you start
A backtest is only as good as its inputs. Before opening the tester, collect four things:
- The EA file and its inputs. The .ex4/.ex5 file plus the parameter set (.set) the vendor recommends — and the documentation explaining what each input does.
- A platform that runs it. Check the EA's format first: an MT4 robot cannot run in MT5. In our review, 23 of the 24 brokers document MT4 and MT5 support, so the platform itself is rarely the blocker; the best brokers for automated trading article scores EA permissions broker by broker.
- Symbols, timeframe and date range. The pairs the strategy was designed for, the chart timeframe it expects, and at least one full year of history — ideally covering both trending and ranging periods.
- Realistic cost assumptions. The average spread on your exact pairs, the commission per lot, and swap on overnight positions. Costs are where optimistic backtests are born.
Running the Strategy Tester, step by step
Both MetaTrader platforms ship with a built-in tester; in MT5 it is the Strategy Tester tab, in MT4 it opens with Ctrl+R. The mechanics differ slightly, but the workflow is the same.
Choose the EA, symbol, timeframe and period
Select the EA file, the symbol it was built for and the chart timeframe. For the date range, prefer at least 12 months — better two or three — so the test crosses different market regimes: trending months, range months, and high-volatility weeks. A test window of one calm quarter proves almost nothing about how the robot behaves when the market changes character.
Pick the modeling mode your strategy actually needs
This setting decides how honestly the tester replays price. From most accurate to fastest:
- Every tick based on real ticks (MT5) — the tester downloads real historical ticks from the broker's server and replays them; the closest simulation to live conditions and the right choice for scalping or high-frequency logic.
- Every tick (MT4) / 1 minute OHLC (MT5) — synthetic ticks generated from minute data; a reasonable middle ground for intraday strategies when real tick history is unavailable.
- Open prices only — usable only for strategies that act once per bar on open, such as daily-breakout logic on higher timeframes. Running a scalper on open prices produces numbers that look clean and mean nothing.
For MT4, watch the "modeling quality" percentage and aim for 90% or higher on tick data. If the tester warns that history is missing, download it first — testing on gaps teaches the robot nothing useful.
Run one test, then optimize — with a forward period
First run a single pass with default or vendor-recommended inputs and read the report. Only then consider optimization. In MT5, enable the forward period option so the tester splits your date range: optimize on one part, validate on the part it never saw. An optimization result that collapses on the forward segment is not a strategy — it is a fitted curve, and it belongs in the trash.
Reading the report: the metrics that matter
The tester report is a table of numbers; four of them carry most of the information:
- Net profit and profit factor — gross profit divided by gross loss. Above roughly 1.3 the strategy pays its bills; below it, costs eat the edge. A value far above 2.0 on a long period deserves suspicion, not celebration.
- Maximum drawdown — the deepest equity dip. Compare it to the profit: a system that made 20% while dropping 60% on the way is a leverage accident waiting to happen, not a gem.
- Number of trades — the sample size. A handful of trades over two years is an anecdote, not evidence; the more trades the test produced, the more the statistics mean.
- Win rate together with reward-to-risk — 90% winners with tiny profits and occasional huge losses is a different animal from 40% winners with large ones. Read the pair, never the win rate alone.
Then look at the equity curve. A smooth, stepped climb is healthy; a flat line for months followed by one heroic spike, or a curve that spends half the period underwater, tells you more than any single metric. Note also the longest losing streak — that is what you will psychologically live through, sometimes while the strategy is still working exactly as designed.
The seven backtesting mistakes that fake an edge
Most losing robots do not lose because the idea was bad; they lose because the test lied. These are the seven mistakes we see most often:
- Overfitting. Optimizing inputs until the past looks perfect. If the vendor's equity curve is flawless but the forward period collapses, you are looking at a fitted curve, not an edge.
- Tiny sample. Fifty trades in three years cannot support conclusions; the confidence interval is wider than the profit.
- Costs ignored or understated. Testing with fixed zero spread while your real broker charges its normal spread plus commission quietly inverts the result. Test with the costs you will actually pay — our low-spread brokers review shows how wide the gap between brokers is on the same pairs.
- Wrong modeling for the style. Open prices for a scalper, or every-tick on a daily system — both waste your time in opposite directions.
- Weekend gaps and news ignored. Strategies that hold positions over the weekend or through high-impact news must be tested across weeks that contained both.
- No out-of-sample check. Testing and tweaking on the same window until it looks good is curve fitting with extra steps; always keep a period the EA never influenced.
- Trusting screenshots instead of running your own test. Vendor screenshots are marketing. The seven signs of a scam robot list shows how fake results are dressed up, and the risks of cracked or "free" robot versions — which often come with falsified performance — are documented separately. Run the test on your own data, in your own tester, on the pairs you will actually trade.
From backtest to live account — the bridge in three stages
A passed backtest is a hypothesis, not a verdict. The bridge to real money has three stages, and skipping stages is where accounts die.
Stage one: demo on the same account type. Run the EA on a demo account of the exact type you plan to fund — same account family, same platform version. Two weeks is the minimum; you are checking that the robot connects, trades on schedule and behaves like the test. If you have not opened the account yet, our step-by-step account opening guide walks through registration, verification and choosing the account type.
Stage two: verified live tracking. After demo, connect the live or demo account to a public tracking service such as myfxbook or FXBlue and let the record build for a few weeks. Verified, dated results are the currency of trust in this market; the EA scam checklist builds on exactly this principle — ask for verifiable history, not screenshots.
Stage three: small real capital, then scale. Fund the minimum you planned — in our review, published minimums run from $1 to $200 — and run the robot live for a period long enough to include a losing streak. When the live behavior matches the backtest and the first withdrawal has been tested, scale gradually. For 24/5 operation you will also want a VPS: 14 of the 24 brokers in our review provide VPS hosting, and our forex VPS for automated trading guide explains what to look for.
Frequently Asked Questions
How many trades does a trustworthy backtest need?
There is no official threshold, but the more trades the test produced, the more the statistics mean. As a working rule of thumb, a strategy tested over a year or more should have generated at least one or two hundred trades; a test with a few dozen trades mostly measures luck. Also check that trades are spread across different market conditions, not clustered in one lucky month.
Which modeling mode should I use in the MT5 Strategy Tester?
Match the mode to the strategy's holding time. For scalping and other short-holding styles, use "every tick based on real ticks" — it replays real historical ticks and is the closest simulation to live trading. For intraday strategies holding positions for hours, "1 minute OHLC" is usually an acceptable compromise. "Open prices only" is valid only for systems acting once per bar, such as daily-breakout logic. When in doubt, run the stricter mode: slower, but honest.
Can I backtest on MT4 or do I need MT5?
Whichever platform your EA was built for — an MT4 robot does not run in MT5 and vice versa. MT4's tester shows a modeling-quality percentage and works well with tick data; MT5's Strategy Tester is stronger: real-tick modeling, multicurrency testing and a built-in forward period. In our review, 23 of 24 brokers document both platforms, so the choice rarely constrains you; the EA format decides it.
Is a profitable backtest a guarantee of future profit?
No — and any vendor who presents it as one is telling you something about themselves. A backtest shows that a set of rules worked on historical data under stated assumptions. Live markets bring slippage, execution variance and regime changes the test cannot fully reproduce. Treat a good backtest as permission to proceed to demo and small live capital, never as a promise.
Why does my EA backtest well but lose money live?
The usual suspects, in order of frequency: live costs (spread, commission, swap) were understated in the test; the modeling mode was too generous for the strategy's holding time; the sample was too small and the edge was luck; or execution differs — requotes, slippage at news, or a broker whose conditions do not match the test assumptions. Compare the live trades against the test trade by trade; the divergence point usually names the culprit within a week.
Your next step
Once the backtest passes, the rest is discipline: demo, verified tracking, small live capital, then scaling — in that order, without skipping. The broker side matters exactly as much: open the mqlicense brokers hub to compare all 24 reviewed brokers on EA permissions, costs, platforms and VPS availability, then follow the account opening guide to set the account up correctly.
If you are choosing a robot rather than testing one, both of our tools were designed for this workflow: TradeKeeper MT5 manages positions with risk-first logic, and LotSmith calculates risk-based lot sizes for your account and pairs — both licensed originals, testable in the Strategy Tester on your own data before any real deposit.
Past performance — from backtests, demos or live accounts — does not guarantee future results. Nothing in this guide is financial advice; verify every condition on the broker's official pages before you deposit.
Turn the report into a plan: size positions from the backtest drawdown.
Turn the report into a pass plan — the prop firm challenge plan explains the targets.
The testing workflow ends with testing the robot on the target platform.