Difference between revisions of "Understanding Portfolio Backtesting"
(→Portfolio Backtesting Diagram)
|Line 77:||Line 77:|
Revision as of 09:46, 6 October 2014
Applying a trading strategy to a number of financial instruments simultaneously offers several advantages:
- Portfolio diversification will produce more consistent results
- Infrequent trading opportunities will be more common across a number of symbols
- Portfolio strategies can maximize profit and minimize risks by allocating the capital within a portfolio dynamically, based on each instrument’s performance
- Portfolio strategies can enter, scale-in, scale-out, or exit positions based on the overall portfolio performance
- Portfolio strategies are generally more robust and less susceptible to over-optimization
Understanding Dynamic Portfolio
A dynamic portfolio strategy is more then simply a collection of separate strategies, and must take in to account a number of additional factors:
- Capital limits
- Entry orders priority
- Money and Risk management
- Overall portfolio performance
Portfolio backtesting offers a number of advantages:
- Backtesting a strategy on a single instrument may not produce enough trades to distinguish a pattern from a coincidence
- Backtesting a strategy on a number of instruments is more likely to reveal any shortcomings and helps to avoid over-optimization
- A robust strategy is likely to demonstrate consistent profitability across various instruments
- By backtesting on a diverse portfolio, the instruments most suitable for the particular trading strategy can be selected
Batch Portfolio Backtesting, also known as Basket Backtesting, evaluates each strategy separately and then compiles the results.
True Dynamic Portfolio Backtesting simulates the actions of a real trader by taking in to account the overall portfolio considerations dynamically, during the evaluation of each bar.
Portfolio equity and the available capital are dynamically evaluated for every instrument, on every bar, in order to determine the amount available to be invested.
When available capital is insufficient to enter all of the trading opportunities that arise simultaneously, the best opportunities are selected according to user-customizable criteria.
In addition to the performance of a particular instrument, portfolio drawdown or other portfolio performance aspects can be taken in to consideration when making entry and exit decisions.
Portfolio Backtesting Diagram
Script Calculation and Raw Order Generation
During backtesting, a single bar of each symbol's data series is evaluated by the strategy's signal scripts, starting with the first (oldest) bar. The series’ bars are evaluated in the order that the symbols appear in the symbols table of the Portfolio Backtester. Based on evaluation of each series’ bar, a set of one or more orders may be generated by the scripts for each of the symbols. Order sets are generated in the same sequence as the series’ bars are evaluated.
This process is illustrated in the Raw Order Generation section of the diagram: the first bar for symbol 1 is evaluated first, and a set of orders is generated based on that bar. Then the first bar for symbol 2 is evaluated, and a set of orders is generated based on that bar. The process is repeated until the first bar for the last symbol (Symbol N) is evaluated.
The resulting sequence of order sets begins with the order set for the symbol 1, followed by the order set for symbol 2, and ends with the order set for symbol N.
PortfolioEntriesPriority function is specified within a strategy, the sequence of the order sets is rearranged based on the criteria specified.
This process is illustrated in the Symbol Prioritization section of the diagram: the resulting sequence of order sets begins with the order set for the symbol 1, followed by the order set for symbol N, and ends with the order set for symbol 2.
The position of a set of orders in the sequence determines its relative priority: the set of orders for symbol 1 has the highest priority (3), set of orders for symbol N has the second highest priority (2), and the set of orders for symbol 2 has the least priority (3).
At the risk control stage, the sequence of order sets is treated as one long sequence of orders. The orders are executed one-by-one from the beginning of the sequence, until all orders are executed, or until the risk control limits defined in Portfolio Settings of the Portfolio Backtester prevent the execution of remaining orders. Any remaining orders that could not be executed are discarded.
This process is illustrated in the Risk Control section of the diagram: all of the orders for symbol 1 and symbol N are executed, while only some of the orders for symbol 2, 100 shares Long @ 55, are executed, due to risk control limits preventing the execution of the rest of the orders for symbol 2.
The entire process is repeated for the next bar of each of the portfolio symbol's data series.