Backtesting

Validate financial models with historical or simulated data

Backtesting is a framework that uses historical or simulated data to validate the performance of one or more trading strategies or risk models. Depending on the goals of validation, financial professionals may use more than one indicator or methodology to measure the effectiveness of financial models.

Backtesting in trading

Picking an investment strategy through research, implementation, and backtesting

How backtesting fits into investment strategy development

  1. Backtesting in trading involves: Automating the repeated execution of investment strategies over different historical or simulated time periods
  2. Aggregating and recording costs
  3. Generating performance metrics

Backtesters then visualize and report on strategy performance. You can use this approach to validate and compare different investment strategies before selecting one for live trading. In MATLAB®, you can leverage the Backtest framework to evaluate and compare investment strategies.

Common types of backtesting for trading include:

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

Backtesting for 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™.

Visualizing VaR model violations

Backtesting to comparing 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