In the last two articles (article 1, article 2), I discussed the need for trading multiple strategies with the same instrument in the same account. This type of capability is very important to a trader who wishes to trade a diversified portfolio, while at the same time efficiently managing margin. Unfortunately, with many platforms this capability is very tough to achieve.
In the last article I introduced a template that could be used to convert a “standard” strategy into a strategy that could eventually be combined with other strategies, and produce the same overall performance that each strategy combined would produce.
Unfortunately, with that method, certain nice and arguably critical features (such as standard stop losses and profit targets) have to be replaced by alternatives (such as exiting next bar at open when a big loss is recognized at the bar close). But, if a trader is willing to accept these tradeoffs, he can obtain an equity curve which is very similar to the original strategy.
Since I previously demonstrated that this method produced acceptable results for one strategy, let’s see if we can combine two of these strategies into one strategy with similar performance.
To do that, we will combine a momentum strategy, shown in Figure 1, with a moving average strategy, shown in Figure 2. These have already been converted into what I call a “summing” strategy – a strategy that can easily be combined with other similar strategies into one “master” strategy. Complete code for both systems is given at the end of the article.
The combination summing code is given at the end of the article. The results are shown in Figure 4.
Since there appears to be only one curve, it means the two results are identical – precisely what we wanted! So, this proves the summing template can be used effectively to trade two strategies in one “master strategy.” Plus, the method is not limited to two strategies – the developer can actually combine as many strategies as he or she desires.
One important note: In the example above, I assumed zero commissions and slippage. So, when you combine strategies, the results should be identical. In reality, though, with commissions and slippage the master strategy will actually have slightly better results, since occasionally conflicting trade signals will cancel out, instead of each being executed.
To recap the method:
- Create strategy number 1 in the summing strategy format given in part 2.
- Create strategy numbers 2-N in the summing format.
- Combine the N strategies together in a new strategy. Care must be taken to have different variable names associated with each strategy. One way to do this is to identify strategy number 1 variables with the suffix “01,” strategy number 2 with “02,” etc.
- Insert the master summing strategy created in step 3.
- Compare the equity curve of step 4 with the sum of equity curves of strategies in steps 1-2. This check ensures that the strategies were combined correctly.
- If the results are the same, then the strategy can safely be traded. Now you are trading two or more strategies with the same instrument in the same account! Tradestation Trade Manager can still be used to check that actual positions match the strategy.
The key to using this method effectively is to create the strategies from the start with the summing code. That is, create it with the end goal of adding it to other strategies. Then, you can run your standard development process (I use my rigorous Strategy Factory process to develop and fully test each strategy) on each component strategy. Once this is done, these component strategies can be added together to create one master strategy – one that will faithfully trade all strategies at the same time.
EasyLanguage Code Download:
The workspace and strategy are availble to subscribers of EasyLanguage Mastery. It's free to join!
When you download the TradeStation WorkSpace and files first, try running each of the summing strategies by itself. Then run strategies 1 and 2 together in that chart. You will see that the results look nothing like they should. Then run Master strategy 03. You will see that its results match strategy 1 plus the results of strategy 2.
If you would like to learn more about building trading systems be sure to get a copy of my latest book, Building Winning Algorithmic Trading Systems.