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.

Diagram: a backtest covers prices before today; a forward test covers prices from today on.Backtest:past pricesTodayForward test: newprices as they arrive
Both use simulated funds only.

How do a backtest and a forward test differ?

#
BacktestForward test
PricesPast pricesNew prices, as they arrive
SpeedThe whole period in one runReal time: a day of prices takes a day
FundsSimulatedSimulated
What it can catchRules that do not do what you meant, costs that use up the gain, too many or too few tradesRules tuned too closely to the past, and how the rules behave on prices nobody has seen yet
What it cannot showHow the rules behave on prices that have not happenedAnything 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.

TestLengthTrades collected
Backtest12 months of past pricesAbout 96, in one run
Forward test1 monthAbout 8
Forward test3 monthsAbout 24
Forward test12 monthsAbout 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