Backtesting Strategy Framework in Financial Toolbox
Learn how backtesting can help you compare how investment strategies perform over historical or simulated market data. You’ll see an overview of the backtesting feature in Financial Toolbox™ and a walk-through of the workflow to develop and run a backtest.
Published: 22 Nov 2020
A backtesting strategy framework, first introduced in R2020b of Financial Toolbox, lets you define investment strategies, run backtests and generate performance metrics for your strategies from historical or simulated market data. The backesting framework, consists of MATLAB objects such as backteststrategy and backtestengine that simplify the workflow associated with developing and testing investment strategies. The framework is a perfect middle ground between black box backtesting tools that don’t let you specify custom backtest conditions and writing a long code to test each of your strategies. With this framework, you can easily build custom investment strategies and assess their performance. You can use object properties to plot the equity curves of the strategies to visualize their performance over the year, compare the strategies turnover, and check the transaction costs of each method. Here’s an example of using the backtesting framework:
First, you define a backtest strategy object which specifies the logic used to make asset allocation decisions while a backtest is running. For example, equal-weighting, maximization of Sharpe ratio, or inverse variance…You can also specify other strategy parameters such as a transaction cost model, rebalance frequency to determine how often the backtesting engine rebalances and reallocates the portfolio, and a rolling lookback window. Once the strategy is defined, create a backtestengine object that specifies the parameters of the backtest which are the strategies defined earlier, the risk-free rate, the cash borrow rate, and the Initial Portfolio value. Then use the runbacktest method to run the backtest against historical asset price data and optionally any trading signal data such as sentiment analysis, text corpuses, or any technical indicator. The backtest is run over the timetable of dividend-adjusted asset price data. After the backtest is complete, you can generate a summary table of the backtest and visualize the results.
For more information on the backtesting workflow, please check the documentation page where you can find more examples on backtesting investment strategies. Thank you for watching.
Featured Product
MATLAB
Up Next:
Related Videos:
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia-Pacifico
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)