Backtesting

What Is Backtesting?

Backtesting is a crucial framework utilized by financial professionals to validate the performance of trading strategies or risk models using historical or simulated data. Depending on the validation goals, financial professionals might use several indicators or methods to gauge the effectiveness of these models. This process helps confirm the viability of strategies and supports informed decision-making in trading.

Applications of Backtesting in Trading

Backtesting in trading involves:

  • Modeling the repeated execution of investment strategies over different historical or simulated time periods
  • Aggregating and recording costs
  • Generating performance metrics

Backtesters then visualize and report on strategy performance. You can use this approach to validate and compare different investment strategies (or alphas) before selecting one for live trading. In MATLAB®, you can leverage the backtest framework to evaluate and compare investment strategies, while accounting for transaction costs and cash management.

Common types of backtesting for trading include:

  • In-sample versus out-of-sample testing
  • Walk-forward analysis or walk-forward optimization
  • Instrument-level analysis versus portfolio-level assessment

Utilizing Backtesting for Effective Risk Management

In risk management, backtesting is generally applied to value-at-risk (VaR) or expected shortfall (ES) models, where the approach is known as VaR and ES backtesting, respectively. Expected shortfall provides an estimate of the expected loss on days when there is a VaR failure.

Typical coverage tests for VaR backtesting include Basel’s traffic light test, binomial test, Kupiec’s proportion of failures and time until first failure tests, Christoffersen’s conditional coverage tests, and more.

Typical coverage tests for ES backtesting include commonly cited tests by Acerbi and Szekely, and Du and Escanciano.

For more on investment strategy backtesting, see Financial Toolbox™, and for VaR and ES backtesting, see Risk Management Toolbox™.

A graph with date on the x-axis and VaR on the y-axis visualizing VaR model variations.

Backtesting to compare multiple VaR models.

See also: algorithmic trading, automated trading, equity trading, market risk, quantitative finance and risk management, conditional value-at-risk, portfolio optimization, Modelscape