Multivariate Johansen cointegration test for ETF trading

In cointegration the theory goes that, if we have two securities, X & Y, that are cointegrated in their price movements, then any big divergence in their spread from their mean should be temporary and result in profitable mean-reverting trades. The most common way of testing for mean-reversion is by using the Dickey-Fuller test. The Augmented DickeyFuller (ADF) test is based on an autoregressive model, where a value from a time series is regressed on previous values from the same time series.

However, in order to test for cointegration of more than two securities, a good approach is to use the Johansen test. The (multivariate) Johansen test can be used to check for cointegration between a maximum of 12-time series, although it is a good practice not to use it for more than 10. The Johansen test can be seen as a multivariate generalization of the ADF test. The generalization is the examination of linear combinations of variables for unit roots. The Johansen test and the estimation strategy – maximum likelihood – makes it possible to gauge all cointegrating vectors, when there are more than two variables (e.g. if there are three variables each with unit roots, there are at most two cointegrating vectors). More generally, (as we will see below) if there are n variables which all have unit roots, there are at most n – 1 cointegrating vectors. The Johansen test provides estimates of all cointegrating vectors. Given a number of securities i.e. when we have many variables for our cointegration test, we can still write the relationship of the current prices as a linear function of the past prices in an autoregressive model, now called the Vector Error Correction Model (VECM).

In our case, we used Johansen test to create a ‘stationary’ linear combination of more than two securities (ETFs), which could then be traded using mean-reverting strategies. We started our portfolio by selecting 2 of the ETFs currently in our portfolio (GLD-ETF for Gold and UUP-ETF for US Dollar) and we performed the Johansen test to add a new ETF to the pair.

For introducing the third ETF to the portfolio pair, we ran the Johansen test on all possible combinations of three price series, so as to find the possible final portfolio and the number of cointegrating relationships we could get out of each triplet.

We chose XRT (ETF for US-Retail) as the best addition and the backtest portfolio for the last 252 trading days was as below (return 3.36%):

However, the benefit of using cointegration for adding a new security to a portfolio is better depicted in the diagram below:

By adding DBC (ETF for Commodities) to our portfolio of GLD-UUP-XRT, we got a return of 4.72% whilst keeping drawdown unchanged!

We have performed the Johansen test in a number of possible combinations of various ETFs for the last 10 years, chosen by common investment intuition & experience.
The results (not shown here) have shown that there are few combinations which could produce exceptional risk adjusted returns and mathematically justify our initial intuition.