Using Cointegration for a Pairs Trading Strategy

A series of articles on using cointegration in a pairs trading system - Part 1 of 3

  • Martyn Tinsley
  • /
  • 12 June, 2018
  • /

  • Abstract:

  • A plain English guide to using cointegration within a pairs trading strategy. We demystify the process for those of us that don’t have a PhD is Math.


This post came about as a result of my own experience and frustration over the past couple of months while I have been developing a pairs trading strategy. After some initial research, I realised that I shouldn’t be looking for ‘correlated’ pairs of instruments to trade, but rather pairs that are ‘cointegrated’.

However the problem I then experienced was that the rationale and knowledge of mathematics that is required to measure cointegration was a very complex subject. Each article I read was filled with words and concepts I was not familiar with and so I was forced to do a significant amount of background reading before I finally felt I understood. Eventually after many late nights of reading, I was finally able to put my new-found knowledge to work in the algorithms of my trading system. I am sure I am not alone with this frustration...

After finally reaching a point where I now have a good understanding of the subject, I decided to write an article that I feel I would have benefited from, had it been available. It attempts to answer all of the questions I had back then, in one place. So here goes, but we warned, although I hope I have explained the necessary concepts from first principles, you will still need to be fairly maths savvy! I hope you find this useful.

By the way, if you are already a Maths PhD then you might find this article too basic for your purposes, so might want to look elsewhere.

Cointegration versus Correlation

I want to start by being clear about a statement made above. The fact that when designing a pairs trading strategy, it is more important that the pairs are selected/filtered based on ‘cointegration’ rather than just ‘correlation’. Here is an explanation:

Correlated instruments tend to move in a similar way. If one has an up day, the other will probably have an up day, and vice-versa. However, over time, the price ratio (or spread) between the two instruments might diverge considerably. See the chart of AUDUSD vs NZDUSD below. Clearly these are correlated but notice how the final ratio between the prices is almost 5% different at the end compared with the start.

Correlation Pairs Trading
Figure 1 - Correlated Example

Cointegrated instruments, don’t necessarily always move in the same direction, although they often will. The spread between the two instruments can on some days increase (and therefore the ratio of prices changes), but the fact that they are cointegrated means that the spread mean reverts and the prices usually find themselves being ‘pulled back together’ to the mean. See the chart of CAC40 vs EuroStoxx50. Although there are also signs of correlation here, pay particular attention to the fact that when the prices do diverge, it is not long before they are pulled back together. These are the visual characteristics of cointegration.

Cointegration Pairs Trading
Figure 2 - Cointegrated Example

It is cointegration, as opposed to correlation that provides the optimal conditions for pairs arbitrage trading. Using the cointegration chart above, it can be seen visually that if the CAC40 (blue line) is above the EuroStoxx50 (orange line), a trading opportunity might be to short the CAC40 at the same time as going long on the EuroStoxx50 until a time that the spread between them reverts back to the mean.

It is cointegration, as opposed to correlation that provides the optimal conditions for pairs arbitrage trading.

Key take-away fact

In the next article...

So far we have relied purely on visual identification of cointegration. It is very important that you do not take this approach as part of your trading system. Visual identification is unreliable and cannot provide you with a measure of statistical significance. Rather you must base your pairs trading strategy on statistical methods of calculating the level of cointegration between a pair of instruments. We start to look at how you can do this is Part 2

Tags: Cointegration Pairs Trading Correlation Algorithmic Trading

About The Author

Martyn Tinsley - Algorithmic Trader

A passion for all things analytical, and in particular for automated algorithmic trading. Founded Trade Like A Machine to promote best-practice trading system development and optimization techniques, helping other algo traders succeed.

Spread the word

If you've enjoyed reading this article then please consider sharing

Get investment in your trading strategy

Opens in a new window

If you've enjoyed this article, please consider sharing

Like what you've read today? Then please consider sharing

Subscribe to our newsletter

By subscribing you are giving your consent to send you emails in accordance with our privacy policy

About Us

We are passionate about algorithmic trading, and about helping other algorithmic traders reach their full potential.

We help traders to develop robust trading systems that deliver results in live accounts.


Built in Yorkshire, UK
Proudly serving Europe and the World