Skip to main content

How to Backtest a Trading Strategy

Backtesting means applying fixed strategy rules to historical charts to see how the strategy would have behaved.

Backtesting workflow with historical chart, rule checklist, and result distribution

The short answer

A backtest is only useful if the rules stay fixed. If you keep changing the strategy during the test, you are not testing one strategy anymore.

What Backtesting Can Teach You

Backtesting can help estimate:

  • setup frequency;
  • win rate;
  • average win and average loss;
  • drawdown;
  • common failure modes;
  • emotional difficulty;
  • market regimes where the strategy struggles.

It does not prove the future.

Before You Start

Write down:

  • market;
  • timeframe;
  • exact setup rules;
  • entry trigger;
  • stop logic;
  • target logic;
  • costs and slippage assumptions;
  • what counts as a valid trade.

Then test that version.

Avoid Cherry-Picking

Do not skip ugly trades because they feel inconvenient. Do not include beautiful trades that did not meet the rules.

The goal is not to make the backtest look good. The goal is to learn whether the strategy has enough merit to test forward.

Consistent backtest sample compared with changing rules and cherry-picked results

Backtest One Market Condition at a Time

If you test trend setups, range setups, breakout setups, and countertrend trades all in one pile, the results become hard to interpret.

Tag market regime and setup type. A strategy may work well in one environment and poorly in another.

Using ZenAlgo

Use TradingView replay and chart tools to review historical setups. Use Grid, ABC, Engine, and Five Elements only according to the rules being tested.

Continue Learning

Risk notice

Backtests can overstate performance due to hindsight, missing costs, data differences, and unrealistic fills. Treat them as research, not proof.