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