Skip to content

#Backtesting

1 ideas

Get new #Backtesting ideas by email

Every Thursday: the week's best ideas, with the newest from #Backtesting.

Backtesting: Testing a Trading Idea Before You Risk Money

Backtesting is the practice of applying a set of trading or investing rules to past market data to see how that idea would have behaved. Instead of risking money to find out whether an approach works, you replay it over history and study the results: how often it won, how much it lost along the way, and whether it behaved the way you expected. It is the same instinct as a dress rehearsal, applied to markets.

Where it comes from

Long before computers, traders tested ideas by hand, leafing through printed charts and price tables to check what happened after a particular pattern or signal. The arrival of cheap computing turned that slow manual work into something you can run over decades of data in seconds, and backtesting became standard practice among systematic traders, fund managers, researchers and hobbyists alike. Today it is used for anything with rules behind it, from a simple moving-average crossover to a portfolio allocation plan.

What a backtest actually needs

Read more

Four things matter more than the software you use: clean historical data, unambiguous rules, a position-sizing method, and realistic costs. Vague rules produce vague results, so write down exactly what triggers an entry, an exit, a stop and a size. Then subtract commissions, spreads and slippage, because a strategy that only works with free, instant fills does not really work.

The main approaches

  • Manual or bar-by-bar testing: you step through a chart candle by candle and record each decision. Slow, but excellent for learning.
  • Spreadsheet testing: signals and outcomes tracked in rows. Good for simple rules and small samples.
  • Event-driven code: a program that processes one bar at a time and simulates orders. Closest to real trading.
  • Vectorised code: fast calculations over whole columns of data, useful for screening many ideas.
  • Validation techniques: splitting data into in-sample and out-of-sample periods, walk-forward testing, or running many randomised variations to see how fragile a result is.

Where backtests go wrong

The classic error is curve fitting: tweaking parameters until the past looks perfect, which usually produces a strategy tuned to noise. Look-ahead bias is subtler, using information that would not have been available at the moment of the decision. Survivorship bias creeps in when the data quietly drops companies or assets that disappeared. Small samples, ignored costs and unrealistic assumptions about fills all inflate results. A backtest is a filter for bad ideas, not proof of a good one.

Practical tips for beginners

Start with one simple idea you can explain in a sentence. Test it across several markets and time periods. Keep a written record of every variant you try, because the more versions you test, the more likely one looks good by luck. Reserve part of the data and look at it only once. Then follow the idea on a demo account before committing real money, and keep position sizes small while you learn.

Historical results describe the past. Markets change, and no backtest can promise what comes next.

#Backtesting: frequently asked questions

What exactly is backtesting, and why do people bother with it?

Backtesting means replaying a set of trading or investing rules over past market data to see how that approach would have behaved, much like a dress rehearsal before the real performance. It lets you study how often an idea won, how deep the losses ran along the way, and whether the results matched your expectations, all without putting money at risk. The purpose is to weed out weak ideas, not to certify a strong one.

What do I need in place before I can run a backtest?

Four things carry more weight than whichever tool you pick: clean historical data, rules written down without ambiguity, a method for deciding position size, and realistic trading costs. Spell out precisely what triggers an entry, an exit, a stop and a size, and subtract commissions, spreads and slippage. A strategy that only looks good with free, instant fills is not really working.

Which backtesting approach suits a beginner best?

Stepping through a chart bar by bar and recording each decision is slow but teaches the mechanics better than anything automated. Spreadsheets handle simple rules and small samples well, while coded simulation comes later once the logic is clear. Many people start manual purely to learn, then move to code for speed and volume.

What are the mistakes that ruin most backtests?

Curve fitting is the classic one: adjusting parameters until the past looks flawless, which usually just tunes the strategy to noise. Look-ahead bias slips in when a decision uses information that would not have been available at that moment, and survivorship bias appears when the data quietly excludes assets that vanished. Small samples, ignored costs and unrealistic fill assumptions all do the same thing, which is inflate the results.

If a backtest looks good, does that mean the strategy will work?

No. Historical results only describe the past, and markets change in ways no replay can anticipate. A backtest works best as a filter that removes obvious bad ideas, so treat a promising result as a reason for cautious further testing rather than as proof.

Videos come from YouTube and posts from Instagram; titles and summaries are our own. All rights belong to their creators.