Vollständiges Transkript von „This simple market timing tool reduces losses by 50%+“. Klicke auf einen Zeitstempel, um das Video an dieser Stelle zu öffnen. Du brauchst ein anderes Video? Nutze den YouTube-Transkript-Generator.
0:00 Today I want to speak with you guys about two super powerful, super simple trading indicators that you can use to significantly improve your risk adjusted returns for systematic trading strategies, particularly in the equities markets using regime filters and breadth filters. So a regime filter is very different to a breath filter, but they are both designed to keep you out of bad market conditions and they are pretty effective. [music] >> [music] >> None of the material in this video is financial advice. I'm experienced in managing my own finances, but I'm not qualified to give anyone advice on what to buy or sell. Everything I do in these
0:47 videos is purely to demonstrate coding techniques, and the code I write is purely for example purposes. You should always do your own research and due diligence before engaging in trading or investing. And please seek professional guidance if you need it. With that said, let's look at some code. So, I've been working on a relative momentum strategy the past few months to add to my strategy portfolio. This is what it looks like currently. You can see that it sidesteps and sits in cash through many of the bare markets over the past 20 years. How does it do this? Well, it's through the power of market regime filters and breadth filters. You've heard me speak about regime filters in the past or index filters. Breadth filters are a new addition to my tool set and I want to explain how they can work together to really improve the riskadjusted returns of a longon only
1:34 systematic strategy. So, before I continue, this is not financial advice. I'm not qualified to tell you what to do with your money. This is what I do with my money. You do without what you will. Take the information. Ideally, go and test it yourself. go and see how this affects your own systems. But this information is based on the writings of several prominent researchers in the systematic trading space. This white paper was written by Meb Faber who is the chief investment officer of Camry Investment Management and is currently responsible for managing over a billion dollars and he's also launched several ETFs and he's a very knowledgeable, very experienced quant investor. He released this paper in 2006, updated it in 2013, and I'm going to show you how this information held up until today. So, first of all, what was this white paper
2:20 about? It's about tactical asset allocation, which is a diversified investment strategy where you invest in different asset classes using simple timing or trend filters so that you sit in cash when these asset classes are not doing well and you stay invested in them when they are doing well. And by diversifying across equities, US equities and foreign equities, bonds, commodities, and real estate, and having a portion of your account allocated to these different asset classes, and using a very simple trend filter, you can achieve really strong riskadjusted returns. I won't go into too much detail about this white paper because you can just read it. It's public. There'll be a link below. It's a fantastic read and I highly recommend any serious systematic trader goes out and reads this. But the
3:05 key takeaway is particularly for equities, the S&P 500 in its history has had several nasty draw downs. Anything over this 30 line or touching it is pretty rough to go through as an investor. Losing 30% of your capital is pretty devastating. Losing 80% is catastrophic. And the 2008 financial crisis, losing 50% is certainly no picnic. That is a rough draw down to go through. As Mebb says at the start of the paper, losing 80% of your account if you're only generating 10% through buy and hold would take 15 years of compounding to recover. And that's if the market returns its average return over that period and you don't enter a period like this where it could last even longer to
3:52 recover your money. So risk management is important in trading. We all know that. What tool does MEB use to significantly improve his risk adjusted returns? Some of you won't believe this, but it's a 10-month simple moving average. When the market is above a 10-month moving average, he stays invested. So, if you look at this ribbon down the bottom here, this is on the S&P 500 SPY. At the end of each month, if this turns red and my strategy goes to cash, I will pretty much have my draw down without affecting my rate of return as a buy and hold investor in the S&P 500. Very simple, very powerful timing mechanism. You can see it here. Uh, it sidestepped the entire 2008 financial crisis. It went to cash pretty early on
4:37 and then reinvested pretty soon after the recovery. Here I have a real test script that I put together. I tried to make it as close as possible to Favor's white paper conditions. So I'm testing this on Spy. The catch is Spy listed in early 1993. So, I can only back test to 1993 for spy, but that's fine because I'm more interested in the out of sample data anyway. Fab's already done the research up until 2012. I want to see how this holds up in into 2026, which is 14 years of out of sample data to test this theory on. So, we're starting our back test from January 1993. We'll end it in January 2012 or he released the paper in 2013, updated it in 2013 based on 2012
5:25 data. So we'll go up to to January 2013. That's in sample data. And then we'll see how this performed on out of sample data. So first of all, let's match up the conditions of the back test that MEB did. Here are MEB's rules in the white paper for testing. Buy when the monthly price is above its 10 month SMA, sell when it's below, and go to cash. All entry and exit prices are on the day of the signal at the close. I tested buying on the next bars open, and it made barely any difference. Um, same with daily bars. The model is only updated once a month on the last day of the month and price fluctuations during the rest of the month are ignored. I did test this on the daily time frame and it made barely any difference. The draw down was slightly higher because of the added granularity of daily time frames, but the concept
6:10 still held up. All data series of total return cash returns are estimated with a 90-day Treasury bill. It's not super important for today's example, but this is the interest rate on your cash when it's not invested. Taxes, commissions, and slippage are excluded. and go and read the practical considerations in the paper if you're interested about the impact of these on a buy and hold strategy. But that's not relevant for today's video. We're focusing on whether this concept broadly works so that we can apply it to other trading strategies as a filter. So I'm going to be using real test for this exercise which is a very robust back testing software and I'm using Norgate data who are a very reputable equities data provider and futures data provider with very high quality data. I've got total return adjustments to my price series uh to match his uh what he says in the white
6:57 paper. Unless otherwise noted, all data series are total return series including dividends and income. We're on monthly bars. We have a 10 period SMA. This is our regime filter. Buy spy when it's above its moving average. Sell it when it's not and wait till it recovers. So let's first do a test where it is not using a regime filter. So between 93 and 2012, the end of 2012, we had a 8% rate of return with a 50% max draw down, which is pretty much on par with what was in his Y paper. Pretty typical for any time period, any reasonably long time period of the S&P 500. Now, let's turn on the regime filter and see what we get. We get a 9.6% return with a 16% max draw down. Let's
7:44 bring over the summary report and have a look at the equity curve comparison. There's a lot more data here. Perhaps I'll link this below. Um I I'll just link to the script below and you can play around with this yourself in your own real test software if you have it. But this is how the system performed from 1993 until 2012. It outperformed the market quite significantly and it sidestepped the 2008 financial crisis in particular and mitigated a lot of the damage in the 2000 tech bubble collapse or at least reduced a lot of the volatility through that period. So, pretty good. Let's see how it held up until today. Let's open this back test up to the latest date and run a test. All right. So, we have a 9.6% average annual return between 1993 and
8:31 2026 today. And we have a 22% let's call it 23% max draw down. So, a higher max draw down. Let's compare without the regime filter a 10% return with a 50% max draw down. So the max draw down stays the same. The 50.78% max draw down of SPY occurred in the in the 2008 financial crisis and as of yet has not been exceeded. I'm sure it will one day but so far it hasn't been. So the rate of return is a little bit lower using the timing mechanism but we have overharved our max draw down from 93 till today with this simple timing mechanism. Just a quick note, while editing this video, I realized I'd forgot to actually use the 3month Treasury bill uh as the cash interest rate. It doesn't really change much if I
9:18 run the script without it and run it with it. Uh the the difference is negligible. And it's also not really the point of today's video. The point isn't how this system does while investing in SPY. It's whether or not this defense regime filter method works to avoid broad market downturns. Because remember, I'm not applying this to spy. I'm going to apply this to alternative strategies as a regime filter. I'm more interested in the concept itself and if it's effective. So there is definitely some merit to this technique. These are the equity curves. Pretty powerful stuff. So how does this apply to my relative momentum system? This is the system that
10:04 I'm currently building. It is proprietary. So, I'm not going to give away all of the code here, but I will give you the basic overview. This system is a relative momentum rotational system. At the end of each month, it ranks all of these stocks in the Russell 1000 and it buys the top number, X number of stocks in that index based on their momentum. And to rank the momentum across all of those thousand stocks, I use this algorithm here, this formula, which is Andreas Clenau's exponential regression calculation. I'm not going to pretend to be smart and understand exactly what this does, but I can give you the layman's uh version of it. So, let's say we have stock A and stock B.
10:50 Both of them rise this much. Let's call it 100% return on both stocks. What this formula will do is first it will rank them based on their slope. So the more steeply a stock has risen, the more favored it will be. However, if the first stock looks like this to get from point A to point B and the second stock looks like this, the first stock will be favored over this one because it is less volatile. So basically a line is calculated between the start and end prices of the period and then how steep the angle of the line is and how closely price hugs it equals a higher ranking. So, it's just a
11:37 volatility adjusted way of ranking momentum between stocks. Volatility might be the wrong word here. It's more like just measuring trend quality and favoring less erratic stocks over more erratic stocks when it comes to their trend in the momentum they're exhibiting. Volatility is really a separate issue. So, if we have two stocks that went up a lot, let's invest in the one that's less erratic and more stable, and that gives us better riskadjusted returns, at least in theory. So, let's turn off my two filters here. I have a regime filter, which is simply Fabers's 10-month moving average test, and I have a bread filter here, which we'll get to in a moment. So, first of all, let's run a few tests. I'll delete these tests. I want to see how my system performs without a regime
12:24 filter and without a breath filter. So, now we're just ranking the best stocks in the index and investing in them blindly, no matter what, at all times. This is what we get. a 21.58% rate of return, which is pretty solid with a 60% max draw down, which is not great. In fact, I think that's worse than the benchmark. Yeah, we've got a worse draw down than the benchmark, even though we've doubled the benchmark's return. But we're on to something. Now, let's apply the technique and concept that Faber discovered about the US equities market and other equity markets on my relative momentum system. So, now we only invest if the Russell 1000 is above its 10-month SMA. and see how that affects our metrics. So there we go. We have lost a little bit of rate of return but significantly improved our draw down
13:09 and the systems volatility. So now we're getting somewhere. If I bring over this summary report. So this is without the regime filter. This is with the regime filter. We have quite a few flat spots here where the system sat in cash during bare markets and some corrections. So far so good, but a 35% draw down is still quite steep. Now, let's try bringing in my breath filter. So, before we do that, what is a breath filter? So, for this one, I'm going to use the high low index. So, if I bring up a description from the internet here, the high low index is a 10day moving average of the record high percent index, which is a breadth indicator. So, basically, we are getting a percentage of how many stocks are hitting new 52- week highs
13:57 versus new 52- week lows. So the higher this reading is, the more bullish the market is broadly speaking. Why is this important and why is this useful as an indicator? Well, one of the reasons, especially in the S&P 500, is this. The important thing to note here is that the top 10 stocks have driven more than a third of the S&P 500's gains over the past 5 years. So what that means is even though the S&P 500 might be going up or whatever market index you trade might be going up and your regime filter might pass, the broad market might not be very healthy, which means the trend might not have much follow through and it might be driven by just momentum in those in those top 10 stocks. Now for a momentum system that gravitates into those stocks, it might not be a big deal. But if your system picks up a few of those
14:44 underperformers along the way that are lagging the market, that's where a brid filter can come in handy. So interpreting the high low index in general, a stock index is deemed strong when the high low index is above 50%, which means new highs outnumber new lows. So let's do a test here. So I've got a regime filter 10-month SMA price is bullish, we stay invested. If it's bearish, we go to cash. We now also have a breadth filter. So, if we don't have more than 50% of New York Stock Exchange stocks making 52- week highs, we do not invest and we stay in cash and and so we have two filters here. So, now we've got our original regime filter and we also have a market breadth or market health filter as well. Let's run a test and let's see how these two filters work together. And there we go. We have
15:30 barely reduced our trade frequency, but we have reduced our max draw down by quite a bit. Our second and third draw downs are very tolerable and our return is the highest of both tests. Let's have a look at the equity curve comparison. So what's happening here? If you have a close look at the at the comparison, one example that stands out to me is in this area here, the breadth filter is keeping us out of choppy markets a bit more often. So here we have a choppy market where the regime filter turned back on but the market breath just wasn't there and the market got dragged lower on the second back test. Here we went to cash a bit more often during that year of 23 and 24. So
16:16 I'm not saying you should trade this. I'm just saying this is an interesting concept to play around with. And so here's a way to visualize the breadth filter. So if we look at 23 and 24 that's this year here. For most of this year, the regime filter was green, meaning a green light to invest. But quite often throughout this year, we did not have broad market strength. And so that kept us out of the markets and kept us from investing in these pullbacks. So, pretty cool stuff. Uh, if you want to try out this high low indicator on Trading View, it'll be linked in the pinned comment below and in the video description. If you bring up the source code to the script, these are the tickers for the New York Stock Exchange high low values on Trading View. So, MAHN is the 52- week highs for the New
17:04 York Stock Exchange, and that's what we get. Now, the caveat is I have no idea if Trading View account for historical constituents in this series, whereas I know for a fact Norgate data does. So, I would highly recommend if you're back testing to use something like Real Test. Uh, but if you're a discretionary trader in the equities markets, you might find this useful for day trading if that's what you're into. One little thing I want to mention before we continue is the impact of signal luck, signal timing luck on this particular indicator filter. So, a great example of this is the 200 uh 2020 COVID crash. This crash here, if I hide the breadth filter for a second and we zoom in here, you can see this is the final trading day of February. and we closed below the 10month moving
17:52 average. So on the first trading day of March, we went to cash. Assuming we're using this filter in a strategy, this is all hypothetical. So we've gone to cash. Our filter failed on the very last day of the trading month. We go to cash and what do we do? We exit all our positions here at the open of this bar and we miss out on a cute little 25% draw down. Intrammon draw down by the way. Now, this is where the dumb timing luck kind of comes into play. There's nothing we could do about this. There's no skill involved in avoiding this. We just got lucky. The filter just triggered luckily on that last day. There's no reason why this price action couldn't have happened a few days earlier or few days later. So, what what does that mean? It means that as an investor and trader, I always had this fear in the back of my mind.
18:38 Will this thing turn on in time if I needed to? Am I going to sidestep these big corrections? Now, the answer is no. You're not always going to be able to outsmart the market. Sometimes you are going to fall victim to bad luck at some point in your trading career. That's just what happens to traders. The key is to manage your risk so well that it's not catastrophic. But we have to take pain. We are paid to take on risk as traders. That's why we get paid by the markets. If there was no risk involved in trading, we we wouldn't be making any money. One of those risks is timing luck. No matter how smart you are at trading or how good you are at trading, especially as a systematic trader, you can't avoid this. However, let's turn on the bread filter. And what is interesting and what you'll note here is that the bread filter turned negative on
19:26 this day, which was the day before our regime filter turned off. Now, again, could be just lucky timing there, but it does add that little extra layer of defense. even if the regime filter had failed, the breath filter failed by the end of that month and we would have gone to cash anyway. So using both filters for some systems, not all systems, um can be an interesting addition. One other thing worth mentioning is that Nick Raj had this thought a few years ago. I read a an article he wrote on his blog post about this exact problem. And one of his solutions to it is to simply split up his portfolio into a 50/50 split that trade the same universe, same system almost exactly. However, one uses a monthly time horizon and one uses a weekly time horizon with a slightly
20:12 different regime filter length. And what you get there is you dilute that signal luck just a little bit without curfeitting the system too much. You're just simply splitting your capital. And one system might go to cash a bit sooner than the other or a little bit after whatever or or react in the middle of this. The the weekly system might get out a week later after the end of the month, you know, down here or something and you don't take that full 20% draw down on the chin. Um, that is one other solution to the timing luck conundrum. But anyway, that's it. That's all I really wanted to say. Before we wrap it up, let me just show you a few back tests on a few different ETFs just to prove that this is a pretty robust technique. It's not specific to the US markets. Um, so here we're running it on the European ETF. If we compare the
20:59 equity curves, you can see that it it really does do a good job of keeping you out of trouble. You can see wherever it flat lines is where the underlying market was not doing well and its volatility picked up. So, it's a pretty robust, pretty broad trend filter that works on nearly every market I've tested it on. To be honest, I just picked these at random. This is a Canadian ETF with a regime filter. Similar returns. We'll have a similar equity curve comparison here. Now, it doesn't always outperform buy and hold, but you're never going to outperform buy and hold with a defensive strategy. But if you get even close to matching it while havinging the draw downs. If we look at the draw down here, 56% draw down versus 28. I mean, most investors will take that any day of the week. Um, and we can even do the Aussie market, the Aussie 200. The catch here
21:47 is that um the currency plays a big role in returns on this system in US dollar terms. So what I need to do is um I just realized I didn't have this 3-month Treasury bill going for the test. Let's throw that in right now um risk-free rate symbol is this. But I need to comment that out for the Aussie market test. Let's run an import and a test. There we go. 6% return, 6.93% return with a 17% draw down versus, you know, it shaved off our return a bit on the Aussie markets, but it did still reduce our draw down. So, riskadjusted returns still improve even on the Aussie markets. And I just realized I forgot to
22:32 include our risk-free rate in the original back test. So, sorry about that. So, let's run a test with the interest included in the back test. I don't know how I missed that. I think I undid a change. You can see instead of a flat line, we get this slow gradual increase. That's the interest rate on our cash balance. But anyway, you get the idea. And by the way, if you have Norgate data, uh you can come to the data content tables page on their website, search for breadth, and you can find a whole list of different breadth indicators for the different markets data packages they offer. And the way to find the tickers for these is to simply bring up Norgate data. There might be an easier way, but this is how I've been
23:18 doing it. Create a static watch list. Go to stock market indices and then look for market breadth indicator and then just read through this list down the bottom left and you'll find all kinds of things to play around with. Some are more useful than others for breadth indicator use cases like what I showed you today. Some of these will be useless for that. Some of them might work even better. For example, you can get the percentage of stocks above their 200 day moving average. That's a pretty effective breadth filter as well. And they have different breadth filters for uh all kinds of different markets here. NASDAQ, Russell 1000, S&P, and obviously broad market listed stocks as well, not just market indexes. Um, these are all the other New York Stock Exchange
24:05 breadth indicator options we have to check out in Norgate if you want to do some experimentation, which I highly recommend. Obviously, beware of curve fitting, but there could be some value in using some of these indicators as filters. So, that'll do it for today's video. If you found it interesting, make sure to hit the subscribe button. I'll be back soon with some more content. any of you are in my real test strategies course. This new relative momentum strategy will go up in there soon once I finish my out of sample testing and I've confirmed that it's reasonably robust to my taste. This isn't investment advice or trading advice. The these are just scripts for you to learn from, take and tweak, make them your own. If you ever have any doubts, please consult a professional. Trading is no joke. You can lose a lot of money in this game and I'm not the one to tell you what to do with your money. But these ideas are worth exploring, worth testing yourself.
24:52 Go and check them out. Do your own research. Do your own testing. Read these white papers. Get this software. Run your own tests. There's no way to shortcut confidence in your trading abilities. But if you want to shortcut the learning process for coding and developing your own systems, go and check out my courses at the arttotrading.com where I share coding lessons teaching you everything I know about back testing and strategy development for scriptbased systems. Take care everybody. Good luck out there. I'll speak with you soon.