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:
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.
End Note: The workspace and strategy files at the bottom of the article demonstrate the complete concept. 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.
Kevin Davey is a professional trader and a top performing systems developer. Kevin is the author of “Building Algorithmic Trading Systems: A Trader’s Journey From Data Mining to Monte Carlo Simulation to Live Trading” (Wiley Trading, 2014.) . He generated triple digit annual returns 148 percent, 107 percent, and 112 percent in three consecutive World Cup of Futures Trading Championships® using algorithmic trading systems.
His web site, www.kjtradingsystems.com, provides trading mentoring, trading signals, and free trading videos and articles. He writes extensively in industry publications such as Futures Magazine and Active Trader and was featured as a “Market Master” in the book The Universal Principles of Successful Trading by Brent Penfold (Wiley, 2010).
Active in social media, Kevin has over 15,000 Twitter followers. An aerospace engineer and MBA by background, he has been an independent trader for over 20 years. Kevin continues to trade full time and develop algorithmic trading strategies.