Please read Part I for the introduction.
In Part I, we saw that if we force the intercept to be zero during linear regression between two series A and B, we end up with A = βB. In this post, we go one step further and define spread = A – βB
Readers of our posts on pair trading will immediately recognize the above relationships. The idea here is that if we assume USDINR to be dependent on DTWEXB, DTWEXM and DTWEXO indices, then we:
- calculate the spread between USDINR and each of the indices in turn,
- check if the spread is ‘stable’ by conducting an adf test on the residuals of the linear fit and checking if the p-value is less than a threshold,
- if the p-values confirm stability, then we can go long/short the spread whenever it deviates from the mean.
When we plot the spreads and p-values, we see that a 50-day period is probably the most suitable time-frame over which to calculate the spread. And, we also observe considerable mean-reversion suggesting that a trading model can be built over it.
In Part III, we will back-test a couple of trading models based on these spreads.
Code and charts are on github.