GARCH Without Pocket Protectors
Since Mole is out visiting family in the beautiful Euro spring, I’m filling in with a guest post today. Mole and I have been e-mailing a bit and shared some great conversations about trading. It started from the excellent series on Raw Edge Discovery and if you haven’t read it, it’s 10 minutes that might save you years of frustration and a nuclear draw down on your account. We have a lot of similar ideas about things, so hopefully I can share a thing or two that can add some ca$h money to your trading account.
About me – I’m an algo trader, somewhere between a quant geek and a chart trader. I’d rather spend my time developing algos than looking at charts all day, though both work and I respect both sides. After all, there are dudes pulling down $100k a month regularly at my firm using Excel, a notepad and Sterling (which is just another mediocre trading platform with charts and blinky boxes that induce ADD). They think python is a snake and c# is a sexually transmitted disease.
If you’re reading this, then you’re probably familiar with quantitative trading. Geeks meet trading. If you’ve been to any type of quant event, you’ll find it filled with dudes wearing ill fitting sport coats that aren’t familiar with the modern phenomenon known as tailoring.
Many of them enjoy the process of intellectual cock stroking more than they do making money. A quick browse of the discussion forums on Quantopian should make that evident. A discussion about mean reversion quickly turns into a Showcase Showdown about whose method of calculating the inverse of the covariance matrix is better.
A lot of the white papers and discussions by quant geeks require graduate level courses in linear algebra and PhD level statistics to follow along. However often you can lift the core concept of what they are doing without brushing up on Laplace transforms. In this post I’m going to be doing just that – lifting a simple concept from the quant world and applying it without 7 pages of partial differential equations.
On to making money.
A great example of how quant geek speak is lost in translation is GARCH. GARCH is an acronym and what it stands for really is irrelevant. GARCH is a method of forecasting volatility. There are multiple 40 page white papers you can download and read if you’re looking for exceptionally dracone reading material. In most of the papers you’ll see pages of drawn out equations with terms like maximum log likelihoods. Yawn…
If you would like to go through the math of GARCH in depth, there is an academic discussion about GARCH with all of the math involved for those inclined on Quantopian in their Lectures section. I’d recommend going through it in depth – if you see how my example could sharpen your trading edge a bit.
The important thing about GARCH is the core concept: volatility is mean reverting, and the volatility tomorrow has a high correlation to the volatility of the past few days. That’s the core idea and it’s not rocket science. The official definition of volatility is the standard deviation of the close-to-close returns. Even that is a bit much to take in on the first bite, so let us break it down into two parts. First, the close-to-close returns, which heretofore, we will just call returns:
returns = (todays close price – yesterdays close price)/(yesterdays close price)
So if AAPL closed at 152 today and closed yesterday at 149:
(152 – 149)/149 = .020 = 2.0%
Now that we have the close-to-close returns, we need to compute the standard deviation over the last X trading days. For an in-depth explanation of standard deviations, see Mole’s post from last week. When it comes to volatility, what’s more important to grasp is the concept: that 2/3rds of the data is likely to occur within +/- 1 standard deviation, assuming the data is normal data. In quant speak, this would be called Gaussian data. Even that can cause quant diarrhea, maybe about which I’ll dive into more in depth if I earn my stripes for a second guest blog post.
Thanks to Yahoo Finance, python and pandas magic we can quickly determine the annual volatility on AAPL: 17.5%. I did some quick back-of-the-envelope calculations on some other targets for comparison:
AAPL: 17.5% PM: 16.3% PEP: 11.7% NFLX: 35.1% SPY: 9.5% QQQ: 11.3% VXX: 56.8%
As day traders, we really don’t care much about this number. Except that we’re much more likely to find targets with high volatility much more fruitful for momentum trading and low volatility targets more fruitful for mean reversion trading. You’re probably better off looking for momentum trades in NFLX than in PM. Again, not rocket science and very obvious from looking at the two charts of the daily returns in NFLX compared to PM.
Now back to GARCH. If you read the blog of Quant Jesus Ernie Chan, He has an excellent post on GARCH predicting the direction of tomorrow’s volatility. And His talk on volatility from Quantcon 2016 is well worth watching, you can grasp the core ideas without a text book on stochastic calculus sitting in your lap. Bonus: I’m even in the video at some point, asking Him a question.
The point of Ernie’s post is that using GARCH on SPY, GARCH is over 58% accurate at predicting if tomorrow’s volatility is going to increase or decrease, compared to today’s. Is that useful? Damn straight it is. And Ernie is being modest with 58%, I urge you to verify his results if you find it fruitful. Let’s look at an example.
Let’s say we have a magic intraday momentum strategy (MIMS). Looking at all of our trades, MIMS has:
Win rate of 50% –
Average winning trades are .8R
Average losing trades are .5R
Further looking at our trading data, we find there is a high correlation between big R wins and the returns on that trading day. Digging further, we find that 64% of our winning trades happen when the returns are over 2.0% on that day. That shouldn’t be shocking and you shouldn’t need XGBoost to find there is a high correlation between big winning trades and the size of the move in the stock that day.
Hmmmm. It looks like if we had a way of finding when the close-to-close returns are likely to be over 2.0% before the market even opens, those are days we would want to be in the pool ready to kick ass and take names with our MIMS strategy. And maybe even goose our position sizes up from 1R to 1.25R.
But if yesterday’s return was 1.7% and GARCH is predicting today’s return to be less than yesterday’s 1.7%, what do we do today when a signal fires off in our MIMS strategy? Well there is a high probability, 58%+, that the return is going to be less than 1.7%. Which means there is even a higher probability of it being less than 2.0%. We know that over 2.0% is where the magic happens.
Which means sitting on our hands and do nothing is a good move, or reducing our position size to something like .5R from 1R. Because math tells us there is a high probability that this trade is likely to end up in the negative side of our R distributions. More simply, this trade is likely to suck ass.
Why is that? Well, there is at least a 58% chance (actually closer to 70%) that today’s returns will be less than 2.0%. We know if the returns are less than 2.0%, then the chances of our trade being successful are only 36% (1 – 64%). We simply avoid days when GARCH predicts the returns to be less than 2%.
This sounds magical. Rainbows and unicorns forever. In the real world, it’s rare that anything trading related that looks as magical in iPython notebooks translates into magical results in our account. This included. GARCH can be a solid foundation to improving performance of intraday strategies, however it can be substantially improved upon. I’ll leave that to the astute trader to research.
In practice, this is likely to improve the expectancy of a momentum system by 0% – 25%. Not bad, but expectancy comes at the expense of trading opportunity. Would you rather take 500 trades with a .25R expectancy or 300 with a .32R expectancy? There is no right answer to that question, it comes down to your personal trading situation.
In summary, we can use GARCH to predict if something is going to move enough that we want to be trading it that day with a momentum strategy. If you’re a mean reversion trader or have a system that trades against breakouts, then knowing when the move in a stock is likely to be small, might be super beneficial to your monthly account statement. This can be beneficial whether you have your 10,000 lines of python strategy running on a colocated Linux server or you’re sitting in front of the computer looking at charts all day – with your itchy trigger finger on the mouse button.
If you recall the recent posts on Raw Edge Discovery, this is just that. Except here it’s not a discovery, it’s a Raw Edge Gift since I’ve done the heavy lifting for you. Go forth and print money.