Most Traders Overlook This – How to Combine Multiple Trading Systems Safely

Adrian Reid shows how to merge multiple trading strategies into one RealTest backtest by combining separate include lists and strategy sections, then allocating capital across them to see how they perform together. The example combines four strategies across SPY, GLD, TLT, Dow stocks, NASDAQ-100, and VIX to test portfolio-level results instead of each system in isolation.
Questions this video answers
combined RTs
2010
SPY, GLD, TLT
Four include lists
Each assigned 30% of total capital
Chapters
One of the most powerful features that you get in Real test is the ability to backtest multiple strategies together in a portfolio. So you can see how the strategies diversify each other and work together to smooth your overall rates of return. There's several different ways you can combine different strategies into one portfolio to backtest them together in realtest. In this video I'm going to show you the simplest way to do that using another one of the example scripts that Marsden provides in the Real Test Example Scripts folder. So let's jump into the script editor and we'll have a look. The script that we're going to be using is called combined RTs. You can see that up here. And it's a simple script that combines four different systems together. Now again, the purpose of this video is not to give you a great portfolio that works beautifully together. It's to show you how to combine systems together into a portfolio so that you can back test them in one go. So what I'm going to do is take you through this script one section at a time. But before we do that, there's a couple of watch outs, things you need to be aware of when you're testing multiple strategies in one script. The first one is that you need to import the data for all of the systems into the one script. And this means you're going to have to be able to identify which data is for each strategy because different strategies are obviously going to use different universes to trade on. So we're going to design the import section in a way that allows each system to call on the data that it needs and exclude or ignore the data that it doesn't. So how do we do that? So, so we define our data source, which is obviously nor gate in this case. And then we're going to have multiple include lists. You can see here there's four different include lists. And include lists allow us to pull in symbols in a way that we can refer to them. So we can refer to include list 1 include list 2 include list 3 we can even name include list so that we can refer to include list by name in the strategy. So the first include list we've got is Spy, GLD and TLT. So this is the S&P 500 ETF, a Gold ETF and a Bond ETF. The second include list is for the Vix system. It's Vix, the three month Vix and Vixi. The third one is all stocks in the Dow Jones Industrial Average, current and past. And the fourth one is the NASDAQ 100 current and past. So each of these different include lists are going to be used by the different strategies further down the script. So I'll just give you a quick overview here. Again, this is Marsden's example script of how to pull together these strategies. So we've got an asset class switching strategy, we've got a Dow Jones Weekly pullback strategy, we've got a NASDAQ rotational momentum strategy, and we have a VIX long short strategy. So when you combine scripts in Real Test, what you're going to do is have all of the import, the settings, the data, the library section at the top, and then you can have a separate strategy section for each of your strategies. In order to make this work, the strategy needs to refer to the correct data. You also need to ensure that all of the parameter values and rule names for each strategy are uniquely named, because if they're named the same, then it's going to get confused. It's going to call them the wrong parameter or the wrong indicator. So you need to make sure you set up your strategies with unique names. And that's exactly why in my example systems, we've used that prefix for each parameter name and each rule name that's unique to the system. So that way, when you combine them together, Real Test knows which one to use and it doesn't get confused how. Hey, if you're finding this video helpful and you want to go deeper with realtest, I've put together a complete free program called realtest Launchpad. The best part is it's completely free and you get lifetime access. So all you need to do is click the link in the description below and register to get access to RealTest Launchpad now. So if you want to learn RealTest fast and get up and running with confidence in the next couple of days, click the link in the description below and get access to RealTest Launchpad. You can just pause this video, click the link, get registered, click and then come back. You'll get instant access to over 30 different tutorial lessons, showing you how to do all of the important functions in Real Test. So click the link below and I'll see you on the inside. Now, back to the video. We've done the import section, we've got a start date, 2010, end date latest, and we save this data as combined. RTD Settings is just the same as our other systems we've got. We refer to the data file, start date, earliest end dates, latest bar size. This is a daily system. Use available bars false. And we've got our holiday list Here, which we're using US holidays, obviously, because this is a US system. Our data section is quite small. In this here we would want to calculate anything that can be pre calculated. There's not a lot of rules in the strategies that you'll see down below. So we've only got a couple of things here. We've got a rule for Contango which tells us when the short term VIX is below the long term vix. And then we've got this VIX flip rule which tells us when VIX goes into or out of Contango. And that's going to be used later on in the VIX system. So as you'll see in this script, we're allocating a certain percentage of our capital to each of the four systems. And then that capital gets divided between the positions that that system holds. So let's first look at the quantity. Our first system is asset class, the quantity is 30%. The second system, the Dow system, the quantity is 30% divided by five. And that's because we want to allocate 30% of the capital here. But we're having five positions. So 30% of the capital divided by five tells us how big each position is. The third system is the NASDAQ momentum. It's also getting 30% of the capital, but also has five positions. So each position is 30% divided by five. The fourth one is the Vix system and the quantity for this system is plus or minus 10% depending on whether it's long or short. So together we've got 10 plus 30, plus 30 plus 30 equals 100%. So 100% of the capital can be spread between these systems and the sizing flows down from the overall account balance. So now we need to specify the rules for each system and we do that with different strategy sections. So in the asset class system here we Specify it's alongside system 30% quantity. The entry setup is that it's the end of the week and it's in list one. In list is a function that we can use to specify the universe. So when you have multiple include list statements, you can either name them or you can just refer to them in sequence. So in list one would refer to this list here because it's the first time we've used the include list. The entry setup is at the end of the week and if it's in that list, we're only going to take one position. We're going to rank them according to the 50 day rate of change and we're going to take the highest position, the exit rule is the end of the week. So this system very simply at the end of the week it takes those three asset classes, ranks them according to the 50 day rate of change, buys the strongest one and holds it till the end of the week and then sells it and then does the same thing again. So it's a very simple strategy. The second strategy here is the Dow weekly pullback. It's a long side system. As we said before, it's a 30% allocation, but that 30% is split between five equal trades. The entry setup is again the end of the week and it has to be in the dji. So in the Dow Jones Industrial Average Index. And the stock must be above its 200 day moving average. We're going to take a maximum of five positions. We're going to rank these positions on the five day pullback. So we've got the close five days ago divided by the close today. So we're buying the most oversold stocks in the Dow Jones Industrial Average Index on the end of the week.
The exit rule is end of the week. The third strategy here, the NASDAQ Momentum, this is another rotational system. Long side, 30% allocation, five equal positions. The entry is, it's the end of the month. So this is a monthly system, not weekly. It has to be in the NASDAQ 100 index. And we also want the SPY to be greater than the 200 day moving average of the spy. So this is a market regime filter. Five equal positions. As we said before, the setup score is using the same IBD relative strength calculation that we used in the rotational momentum lesson earlier. And the exit rule is the end of the month. So this system really simply takes all stocks in the NASDAQ 100 index at the end of the month. If the SPY is above the 200 day moving average, then it, it ranks them according to the IBD formula. It takes the top five, buys them and holds them until the end of the month and then sells them and then re ranks and does it again. And then finally we've got the VIX long short system. This is long or short vix and depending on whether VIX is in contango or not, it'll either buy or short Vix. So if Vix is in contango it shorts the Vixi. If it's not, then it buys the Vixi. We with 10% allocation. So the entry rules is the symbol must be vixi. So this system only trades vixi. And if you're not in a position or if VIX flips, then you buy or short sell. And the exit rule is when VIX flips. So the idea here is where the long or short vixie until a contango status flips. So a quick overview. We have the import section where we import the data for each of the different strategies in into one data file we have the settings section, same as any normal system, we have the data section. And in the data section we need to be careful. If we've got multiple rules and parameters we're defining, we need to give them unique names so that systems know exactly which rules or parameters to refer to. Then we have a separate strategy section for each system. And in those strategy sections we need to define the direction long, short. You need to define the position size, which includes baked into it the capital allocation. And then we need to define the entry and exit rules like we have here. You can combine as many strategies as you want, but you've got to remember that when you do this, all of the data has to be imported into the one data file. So if you're using strategies like this for multiple different markets, let's say you're trading Australian stocks and US stocks and Canadian stocks and Hong Kong stocks. If you're going to import all of that into one data file, that's going to get very unwieldy quite quickly. So the best way to test multiple strategies like this is when they're all trading the same markets or similar markets, or if you've got ETF systems or index systems that only need a small number of tickers, then it's pretty easy to combine them into one data file. So we've got all of our different strategies fully defined. If we apply this and hit test.
Now, we can see the test results of all systems combined. And if I just double click on this, what it'll show you is an equity curve for each strategy individually and then the combined equity curve. So you can see we've got some work to do here on this script. Some of these systems have huge drawdowns. Like the asset class system has very big drawdowns and it's not something I'd recommend trading. But again, the point of this exercise is to show you how to combine multiple strategies together. Not to give you a ready made portfolio of amazing strategies. We also need to make sure obviously we include slippage and commissions appropriate to each strategy when we're doing this sort of testing. Okay, so we get multiple different equity curves and we get a combined equity curve. And then we can look at how these perform form and Decide whether we've got the weightings right, we can adjust that, we can even optimize those weightings to improve the way the portfolio works together. Because the capital allocation is essentially defined in the position size, we can set position size as a formula. So that will allow us to play with the position size and find the best allocation for each strategy. Now, my personal approach would be to fine tune and finalize each strategy individually, then combine them, and then play with the weightings, rather than trying to optimize and fine tune each strategy at the same time as optimizing and fine tuning the weightings between the strategies. If you try and do both of those things together, I think there's a high chance you'll get tripped up and make some mistakes. So I like to work on each strategy individually, get that finalized, then combine them together into the script, work on the weightings, and get the portfolio working as well as I can as a second step. So with this approach, your position size or your quantity is going to define your total exposure when you add multiple systems together. So, so make sure that it doesn't add up to excessive leverage that you couldn't achieve in real life or put you at risk of having a massive drawdown. If you're concerned about your exposure from the combined systems, when you run the backtest, you can look at the exposure chart over here at the end, and it'll show you how much exposure your portfolio has. So you can see this portfolio is pretty heavily invested. The exposure is bouncing around 100% here. It does drop down from time to time as some of the systems go to cash. But this is a good way to keep an eye on how your allocation is working, how effectively your cash is being utilized, and whether or not you're taking on excessive risk by being overexposed. One more powerful thing that you can do once you've combined all your strategies into one script and run the backtest is look at how effectively they work together and how effectively your capital is being utilized. So on the exposure chart, you can actually look at each system individually. So you can see asset class and Dow Weekly Pullback are very heavily invested. Almost. Well, 30%, because we allocate 30% to these systems, but they're pretty much taking up their entire allocation most of the time. This NASDAQ momentum is pretty heavily invested apart from when it goes to cash. And this VIX long short system is also pretty heavily invested, but it does drop a little bit as your VIX position erodes. And then the combined portfolio here. So if you want to get your capital more efficiently utilized, then you want to find systems that use cash when these other systems are not invested. And that'll help you improve the capital efficiency of your portfolio. So now it's over to you. If you've got multiple systems, you can combine them together into one script using this template as a base. In the import section, make sure you've got separate include lists for each strategy, so you can refer to them in the strategy section. In the parameter section and the data section, make sure that everything is uniquely named so that each system can refer to the correct input values. And then in the strategy section, make sure the system is fully defined and refers to all of the correct input. And of course, because you've got multiple strategy sections, you need to make sure you specify which tickers by referring to the correct include list that strategy should trade. After you've done that, run the backtest, play with the capital allocations and see what you can come up with. And now you have at your disposal some of the most powerful functionality in systematic trading. The ability to combine multiple strategies into one script and run a combined backtest and optimize the capital allocations, position sizing and even the parameter values between strategies to maximize your portfolio performance. That's all for this lesson. I'll see you in the next one. Bye for now.
Sat.











