By Symbol analysis is now available for any strategy by analyzing the strategy trades. Add one line of code to the strategy and run the Optimizer in
Historical Trades: No Coding with By Symbol Optimization for the by symbol analysis. The analysis produces all performance metrics pictured below for each symbol.
Here is the how to detail:
1. Save Trades - Save strategy trades by executing Community Components
SaveHistoricalTrades once at the very end of the strategy Execute block:
CODE:
Please log in to see this code.
Use Open, Close or Price in above to match your strategy and save HistoricalTrades.csv to your Documents folder (edit above path). Trades may be saved from any strategy. Both Single Symbol Backtest (SSB) and Multi Symbol Backtest (MSB) modes are supported.
2. Open HT Optimizer - Verify that the saved csv file name is active in HistoricalTradesConfig.txt located in the documents folder. Open the downloadable strategy "Historical Trades: No Coding with By Symbol Optimization." You will see the strategy results.
3. Run Optimizer - Run an optimization for by symbol performance results - see "To optimize by symbol" in the Strategy Description. All symbols must be in the same dataset.
Optional - From Historical Trades do a Multi Symbol Backtest (MSB) to see the WL By Symbol tab results - see "To run Multisymbol Backtest (MSB)" in the Strategy Description.
Use your preferred position sizing for the analysis.
Combinations - Combine strategies by saving each strategy’s trades to a different csv file. Activate all file names in HistoricalTradesConfig.txt located in the Documents folder. This is a very easy no programming way to combine strategies. By Symbol performance can then be done on the combination. Note that percent equity is is applied based on total portfolio equity on each bar which cannot be done with WL native Combination Strategies.
Historical Trades is a tool that requires no coding and will model most any strategy or combination of strategies.
The MS 123 Scorecard metrics available by symbol are: