fastbot
Back to Blog
Β·2 min read

What Is Backtesting: Testing a Strategy on Historical Data

Backtesting is running a trading strategy on historical data to assess its performance. We explain how to do it, the key metrics, and traps like overfitting.

BacktestingStrategyTradingTesting

Do not put real money into an unproven strategy

Before risking real money on a trading strategy, there is a way to check how it would have performed: backtesting β€” running the strategy on historical price data to assess its performance. It is a basic but crucial step to avoid "betting blind."

How backtesting works

  1. Define clear rules: entry conditions, exit conditions, stop-loss, position sizing β€” specific, not vague.
  2. Apply to historical data: simulate the strategy "trading" through the past data.
  3. Measure the results: see how the strategy profited/lost over that period.

The goal is not to prove a "sure win," but to weed out clearly bad strategies and understand the risk profile.

Key metrics

  • Win rate: the percentage of profitable trades β€” but not everything (a low-win-rate strategy can still profit if wins are larger than losses).
  • Risk-reward and expectancy: the average win versus average loss decides whether the strategy is profitable long term.
  • Maximum drawdown: the deepest loss β€” showing how much "pain" you must endure and whether you can hold on.
  • Number of trades: too few trades makes the result statistically unreliable.

Dangerous traps

Backtesting easily creates illusions if you are not careful:

  • Overfitting / curve fitting: tweaking parameters to fit the past perfectly β€” pretty on paper but failing on new data. This is the number one trap.
  • Look-ahead bias: accidentally using information not available at the time of the trade.
  • Survivorship bias: only testing on "surviving" assets, ignoring those that collapsed.
  • Ignoring real costs: not accounting for fees, the spread, or slippage β€” producing fake results.
  • Past does not guarantee future: a strategy that won in the past can fail when the market changes.

How to make backtesting more reliable

  • Separate out-of-sample data: optimize on one period, validate on a different period never used.
  • Account fully for real costs.
  • Test across multiple periods and market conditions (up, down, sideways).
  • After backtesting, paper trade before using real money.

Conclusion

Backtesting is running a strategy on historical data to assess performance and risk, measured by win rate, expectancy, and maximum drawdown. But beware overfitting, look-ahead bias, and ignoring real costs β€” the traps that make results pretty on paper but failing in reality. Validate on separate data and remember that the past does not guarantee the future.


Next step

Tested your strategy and want to automate TradingView signals into orders?

πŸ‘‰ Open fastbot β€” TradingView webhook to automated orders, free to use β€” sign up via @fastbot_support.