Strategy 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.
On this page

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.

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. Trading systems can be discretionary or nondiscretionary and mechanical or nonmechanical.

Multiple services are available to backtest trading strategies, but a key component of any test of a system’s performance is reliable historical data. While reliable, clean historical data may seem easy to find, ensuring the data used in the backtest is similar to the data used when trading the system live is important. Backtests should cover a long enough period of time to assess the system’s performance across different market conditions.

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 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.

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