This section details two main strategy categories with differing philoshopies:
Mean Reversion -> We bet that prices will go back to their mean in the long run.
Momentum -> We bet that the prices will continue to trend to the same direction over the long run.
Mean Reversion
This chapter on Mean Reversion is mostly based on Ernest Chan's great book Algorithmic Trading
Mean Reversion rests on the idea that some price spread eventually goes back to its baseline mean, as illustrated above. The main thesis is that if we find a mean reverting price spread, we can profit by buying when the price spread goes below the mean and selling once it goes back to the mean.
Problem is, assets that exhibit mean reversion by itself is very rare. So to implement this, we sometimes employ Pairs Trading. That is, we look at pairs of assets whose combined price spread exhibit mean reversion. We will look into this more detail below.
In this section we will explore:
How to detect assets that are mean reverting
How to create mean reverting strategies from said assets
Examples of some mean reverting strategies
Plus Minus of mean reversion
Some example implemented mean reversion strategies can be seen here:
https://github.com/Aldo-Aditiya/algo_trading/blob/master/strats/experiments/20220628_s-stat-arb_d-lq45/original.ipynb
Detecting Mean Reverting Assets
A mean reverting asset is an asset with a mean that does not change too much over time. We call this characteristic: Stationary.
There are multiple ways to statistically test for the stationarity of an asset price:
Augmented Dickey-Fuller Test is used to determine if we can reject the null hypothesis that the price series is not stationary.
Hurst Exponent and Variance Ratio is also used to test further if the price series is more stationary, random walk, or trending.
(H< 0.5 means stationary, H > 0.5 means more trending)
Ornstein-Uhlenback Formula for calculating the half life of mean reversion (meaning, how long does it take for a price to mean revert)
Reasoning: We would not want a price series whose half life is too high, as that means we have less opportunity to conduct our mean reverting trade.
The half life is also useful for setting our mean lookback parameter (e.g. Moving Average over 100 days, if the half life is 100 days)
In practice, you use a combination of these tests to filter out assets.
But again, the problem is that it is rare for single assets to exhibit mean reversion. Enter Pairs Trading. The idea behind pairs trading is that we can find a linear combination of two non-mean reverting asset prices that is potentially mean reverting. This is also called Cointegration.
For more intuition on Cointegration, look at the difference between correlation and cointegration below.
In practice all of the above methods are already implemented in some library so you can just directly use it.
Cointegration is one of the main methods of detecting mean reverting asset prices. There are many more methods of detecting mean reverting asset prices, which is not covered here. To read more, go here:
So you've found the price spread that you think is mean reverting. But how do you trade it?
For a single asset mean reversion, the idea of trading it is by buying when the price is below some mean measure, and shorting when the price is above the mean measure. But how about in pair trading?
Assume we are given the price spread of the form . Same as in a single asset, the idea is we do long when we expect the price spread to increase, and short when we expect the price spread to decrease.
But we cant directly trade the spread itself, we have to trade on each asset. So doing long and short on the spread translates to:
Long the Spread -> We expect the spread to increase, thus we long and short . This is because an increase in spread means either the increases or decreases.
Short the Spread -> We expect the spread to decrease, thus we short and long . This is because an increase in spread means either the decreases or increases.
In the case where both and move the same direction, we neither make nor lose money, because both the long and short position offset each other.
Note that doing short is not always possible.
So that's the idea of trading mean reverting price spreads. How do we actually implement it? There are a couple of ways:
Bollinger Bands -> Rolling standard deviation from the Moving Average.
We can determine long or short positions based on where the price is located on the bollinger band.
For example: We might set our strategy as doing long when price is -1 std from the current MA, and short when +1 std from the current MA. We exit the position when price crosses the MA.
Kalman Filter -> Used to "smoothly" change the hedge ratio and the mean . Both of which are used as a basis to create the bollinger band which we can trade on.
Tends to be more accurate in tracking the price spread than simple regression based hedge ratio.
The details of this method is beyond the scope of this discussion.
Another thing to note is the question: What happens if instead of reverting back to the mean, the price instead keeps trending down/up? In that case, if the price keeps on doing that, our mean reversion strategy will lose money.
If you believe that the mean reversion will still hold, then it'd be best to scale in. For example, if price goes up from +1 std to +2 std, then we would add more to our long position at +2 std.
if you believe the mean reversion will not hold, then it is best to exit the position.
Whether or not the mean reversion will still hold is a tricky question, and is affected by Regime Change.
Plus and Minus of Mean Reversion
Plus
There is potentially a good fundamental story on why two or more assets are cointegration
For example, GLD and GDX used to be cointegrating because industry of mining gold will of course related to gold itself.
Spans great variatey of time scale. So you can find mean reverting behavior in monthly tmeframes, or even hours timeframe. As a sidenote, fundamental investors are mean reverting traders on a large time scale.
Minus
Prone to Regime Change, which is difficult to detect.
Easy, and thus easier to have alpha decay - the quant quake of 2007s was a result of overcrowing of trades with similar alphas.
Momentum / Trend Following
I have not read too deeply into this, so I am not in the position to write about it. You can read more here:
Trend Following - https://www.amazon.com/Trend-Following-Updated-Millions-Markets/dp/013702018X