Strategy Backtesting

Strategy backtesting is the process of testing a strategy’s performance with historical, quantifiable data. Backtesting provides insights into a strategy’s effectiveness in multiple market conditions and the opportunity to compare historical results relative to a benchmark.
On this page

Backtesting is foundational in strategy development. Backtesting requires you to define specific parameters to observe the historical performance of a strategy.

Backtests utilize quantifiable criteria, including a strategy’s entry, exit, and position sizing to simulate trading performance for a specified period using historical price data. 

When creating a trading system, a number of decisions must be made to filter and optimize returns. It is important to define the key inputs of a trading system so that you can test multiple versions of the system by modifying the inputs. Backtesting enables you to observe the results of multiple variables.

Trading systems can be discretionary or non-discretionary and mechanical or non-mechanical. However, strategy backtesting requires defined entry and exit criteria and is most frequently used to test non-discretionary, mechanical systems.

Backtest Results

Backtests typically provide a performance summary of a system’s historical results. These summaries include key strategy performance metrics such as starting portfolio value, ending portfolio value, winning trades, losing trades, profit factor, annualized performance, maximum drawdown, Sharpe ratio, CAGR, average trade duration, maximum consecutive wins and losses, and more.

While past performance is not indicative of future returns, backtest results provide a framework for a system’s historical performance throughout different market conditions.

Sequencing of returns should be considered. While it may be helpful to know how well a strategy can perform, it is equally important to know what a typical losing period looks like and whether you are willing to withstand a significant drawdown during a strategy's lifetime.

Backtesting allows you to assess a strategy's volatility and range of outcomes to determine if it is suitable for you. Knowing the worst-case scenario of a strategy’s past performance can provide confidence when an inevitable losing streak occurs.

Multiple software applications and services are available to backtest trading strategies, including simple spreadsheets and graphs. It is important to have reliable historical data to accurately test a system’s performance. 

While reliable, clean historical data may seem easy to find, ensuring the data used in the backtest is similar to the data used when live trading the system is important. 

Backtests should cover a long enough time period to assess the system’s performance across different market conditions.

Robustness

Robustness refers to a system’s returns when input variables are changed slightly.

For example, if a trend following system is tested using a 20-day simple moving average for trading signals, a robust system would have similar returns if the signal used a 19-day or 21-day simple moving average.

Robust trading systems should work well across multiple markets, demonstrate consistency in different conditions, and show limited sensitivity to changes in the system’s parameters.

Optimization

Optimization is the adjustment of system parameters to achieve improved performance. Optimization often uses machine learning to find the optimal input parameters within a given range.

For example, when optimizing a trend following strategy, the number of days used in a moving average calculation may be varied within a user-defined range to find the optimal entry or exit signal.

Optimization is important as market conditions change. Strategies rarely perform the same way in perpetuity; continually testing and optimizing a system is often necessary.

Tailoring Your Backtest

Strategies should be customized to fit your lifestyle and mental models. Even if a strategy has strong historical performance, it may not suit your investment style, availability, time frame, or biases

Investors should tailor their strategy to their desired performance metrics. One investor may prefer a high win rate, while another investor prioritizes the smallest drawdown. The same entry and exit criteria can have significantly different long-term results by varying allocation or position sizing.

Get new updates to the Handbook
Be the first to get notified when we publish new updates or expand the Handbook.
Was this helpful?

FAQs

How do you backtest a trading strategy?

Strategy backtesting requires defined entry and exit criteria. When designing a trading system, a number of decisions must be made to optimize results, including what markets to trade, position size, when to buy or sell, when to exit a losing trade, and when to exit a winning trade. After defining the relevant criteria for the backtest, the strategy is tested on historical data to assess performance.

Backtests typically provide key metrics such as starting portfolio value, ending portfolio value, winning trades, losing trades, annual performance, maximum drawdown, Sharpe ratio, average days in winning trades, average days in losing trades, maximum consecutive losses, and others. 

How do you backtest a trading strategy using excel?

Historical data can be downloaded and analyzed with a spreadsheet to determine strategy performance. Users can establish specific criteria to define sets of rules to backtest the information. Conditional formulas and data filters may be used to facilitate the process. Excel will then display the results of the indicator with the inputted data to identify historical outcomes.

How do you manually backtest a trading strategy?

The computerization of financial markets allows investors to analyze historical data more efficiently. If an investor wants to manually test how a certain strategy has worked in specific market conditions in various securities, a visual inspection of historical price charts can be used to test theories or trading strategies. Historical data can be downloaded and analyzed with a spreadsheet to determine strategy performance. 

How accurate is backtesting?

Strategy backtesting is the process of testing a strategy’s performance with historical data. While past performance is not indicative of future returns, backtesting provides insights into a strategy’s effectiveness in multiple market conditions and the opportunity to compare historical results relative to a benchmark.

Backtests utilize quantifiable criteria, including a strategy’s entry, exit, and position sizing, to simulate trading performance for a specified period using historical price data. Backtests typically provide key metrics such as starting portfolio value, ending portfolio value, winning trades, losing trades, annual performance, maximum drawdown, Sharpe ratio, average days in winning trades, average days in losing trades, maximum consecutive losses, and others.

Trade smarter with automation