Backtesting vs forward testing: what is the difference?
By Oalgo · Last reviewed
A backtest runs your rules on past prices. A forward test runs the same rules on new prices as they arrive, with simulated funds only. The backtest is quick and uses prices you have already seen. The forward test is slow and uses prices the rules were never tuned on.
How do a backtest and a forward test differ?
#| Backtest | Forward test | |
|---|---|---|
| Prices | Past prices | New prices, as they arrive |
| Speed | The whole period in one run | Real time: a day of prices takes a day |
| Funds | Simulated | Simulated |
| What it can catch | Rules that do not do what you meant, costs that use up the gain, too many or too few trades | Rules tuned too closely to the past, and how the rules behave on prices nobody has seen yet |
| What it cannot show | How the rules behave on prices that have not happened | Anything beyond the short stretch of prices it has run on |
When do you use each one?
#- Backtest first. It takes minutes, so you can change a rule and run it again.
- Forward test second. It needs time to collect trades, so start it with rules the backtest has already checked.
- Both before you decide whether to Go Live.
Why does a forward test take so long?
#It can only collect trades at the speed the market produces them. Take rules that make about 8 trades a month, a made-up figure.
| Test | Length | Trades collected |
|---|---|---|
| Backtest | 12 months of past prices | About 96, in one run |
| Forward test | 1 month | About 8 |
| Forward test | 3 months | About 24 |
| Forward test | 12 months | About 96, after a year of waiting |
A forward test of one month has too few trades to read much into. The trade count guide explains why.
What can neither one tell you?
#Neither says what prices will do next. A forward test is a short run of new prices, so it can agree with a backtest by chance. No real order is placed in either, so a real fill can differ from a simulated one. The forward test is the check that can expose rules tuned to the past (overfitting).
In Oalgo you can tell Oalgo AI your idea in your own words, check the rules it builds, and run a backtest and then a forward test on them. After testing, if you choose, you Go Live with your own Live Strategy on your own Venue Account at a Supported Venue.
Read next
- Backtesting vs paper trading: which should come first?Backtest first to check what rules do on past prices, then paper trade them on live prices with simulated funds. See what each answers and why the order.
- How to read backtest results: a step-by-step guideHow to read backtest results step by step: trades and dates first, then drawdown and fees, and the end result last. Plain definitions of each number.