How to Backtest a Trading Robot Properly
Give a competent person a strategy tester and an afternoon, and they can make almost any robot produce a beautiful rising equity curve. That is not fraud, it is just how optimisation works: adjust enough settings against past data and the past starts agreeing with you. A backtest is only worth something when it is built to be able to fail. Here is how to run one honestly, and how to tell whether the result means anything.
Start with the data, because nothing else matters if it is wrong
The single biggest difference between a meaningful test and a fantasy is the tick data underneath it.
Real tick data is the actual recorded sequence of price changes. Interpolated data takes one minute bars and invents a plausible path between the open, high, low and close. That invented path is where the lie lives, because a strategy with a stop and a target inside the same bar depends entirely on which one was touched first, and interpolation guesses.
In practice, that means a scalping or intraday strategy tested on low quality data can show results that could never have happened. In the MT5 tester, use every tick based on real ticks. In MT4, aim for 99.9% modelling quality with imported tick data. If a backtest does not state its data source or modelling quality, treat it as decorative, as covered in how to spot a fake track record.
Make the costs realistic
Default tester settings are usually more generous than any broker you will actually use. Fix three things:
- Spread. Do not test on a fixed low spread. Use variable spread from real ticks, or set it to a realistic average for your broker and instrument. Strategies with small targets live or die here, and gold is far wider than a major pair.
- Commission. If your account is raw spread with commission, enter it. Leaving it out inflates every single trade.
- Swap. If the strategy holds positions overnight, swap is a real recurring cost, and it triples once a week for the weekend.
A strategy that only works with unrealistic costs does not work. Better to find that in the tester than on a funded account.
Choose a period that could embarrass the strategy
Testing a trend following robot over a period that trended is not a test, it is a demonstration. Your test window should include conditions the strategy would hate: ranging markets, high volatility, quiet summers, and at least one sharp shock. A few years of mixed data tells you far more than a spectacular six months.
Be suspicious of any result presented over a short window. The shorter the period, the easier it is to find one that looks perfect, and the more likely you are looking at a selected sample rather than an edge.
The step that separates real from fitted: out of sample
This is the discipline most people skip, and it is the one that actually matters.
- Split your data. Use roughly the first 70% to build and optimise, and set the last 30% aside completely.
- Do all your work on the first part. Optimise, tune, choose settings, until you are happy.
- Then run those exact settings, unchanged, on the untouched portion.
If performance holds up reasonably, you may have something. If it collapses, you did not find an edge, you found a set of parameters that described the past. And the crucial rule: once you look at the out of sample result and go back to adjust settings, that data is no longer out of sample. You have contaminated it, and you now need fresh data to test on.
Tested the way this article describes
This is exactly why the FundedEA Algo robots are validated on real tick backtests rather than on default tester settings, and why the results are presented with the drawdown alongside the profit instead of a curve on its own. HFT and PROP are built to run inside prop firm limits, with SIZER fixing the risk per trade and GUARD enforcing the account limits. No backtest predicts the future and no robot guarantees a pass. What an honest test tells you is whether a strategy ever had a reason to work.
See the Plans →Then forward test, because the market has not read your backtest
A backtest is a simulation against known data. A forward test runs the strategy on a demo or small live account in real time, against real spreads, real execution and real slippage, on data nobody has seen. It is slower and much less flattering, which is precisely why it is worth doing.
Run it for long enough to include a losing stretch. A strategy that has only been observed while winning has not really been observed. This is also where you find the practical problems a tester never shows: the robot needing a VPS to stay running, execution differences on your specific broker, or behaviour around news.
How to read the numbers without fooling yourself
- Profit factor. Gross profit divided by gross loss. Modestly above 1 is a real result. Very high figures over a short test usually mean curve fitting rather than brilliance.
- Max drawdown. Look at this before the profit. It tells you what the strategy costs you emotionally and whether it could survive a prop firm limit.
- Number of trades. A result from 40 trades is noise. Hundreds of trades across varied conditions start to mean something.
- The shape of the curve. A smooth ramp with one enormous winner is a lottery ticket, not a system. Check whether removing the best few trades destroys the result.
- Consecutive losses. Whatever the worst streak was in testing, assume the live version will be worse, and ask whether you could sit through it.
The signs of an overfitted robot
- A long list of finely tuned parameters, especially oddly specific ones.
- Results that fall apart when a setting is nudged slightly. A robust edge tolerates small changes.
- Excellent performance on one pair or one timeframe and nothing elsewhere.
- A flawless equity curve with almost no drawdown, which is the clearest tell of all.
For prop traders, test the rules and not just the profit
This part gets forgotten. A robot can be profitable across a year and still fail a challenge, because passing is not about the final number, it is about never breaching along the way. So when you review a backtest for prop use, ask different questions: what was the worst single day, and would it have broken a 5% daily limit? Did the equity floor ever come within reach of a 10% max drawdown? On a trailing drawdown, would the rising floor have caught it?
A modest strategy that never came close to a limit is worth more to a funded trader than an aggressive one with a better total return and one terrible afternoon in it.
The bottom line
Backtest on real tick data, with realistic spread, commission and swap, over a period long enough to include conditions the strategy dislikes. Optimise on part of the data, validate on a part you never touched, then forward test in real time before trusting it. Read drawdown before profit, distrust results built on few trades or perfect curves, and for prop accounts test against the risk rules rather than the return. A backtest cannot tell you a robot will work. Done honestly, it can tell you whether it deserves the chance to try.
A backtest designed to succeed will always succeed. Only one designed to fail can tell you anything.
Educational content only, not financial, investment or trading advice. Backtest results are hypothetical, depend on the data, costs and assumptions used, and do not indicate or guarantee future performance. Most prop-firm accounts are simulated. No robot guarantees passing a prop firm challenge or any profit. Trading carries substantial risk of loss.