Cointegration in Forex Pairs Trading

Cointegration in forex pairs trading is a valuable tool. For me, cointegration is the foundation for an excellent market-neutral mechanical trading strategy that allows me to profit in any economic environment. Whether a market is in an uptrend, downtrend or simply moving sideways, forex pairs trading allows me to harvest gains year-round.

A forex pairs trading strategy that utilizes cointegration is classified as a form of convergence trading based on statistical arbitrage and reversion to mean. This type of strategy was first popularized by a quantitative trading team at Morgan Stanley in the 1980s using stock pairs, although I and other traders have found it also works very well for forex pairs trading, too.

[adrotate banner= “65”]

Forex pairs trading based on cointegration

Forex pairs trading based on cointegration is essentially a reversion-to-mean strategy. Stated simply, when two or more forex pairs are cointegrated, it means the price spread between the separate forex pairs tends to revert to its mean value consistently over time.

It’s important to understand that cointegration is not correlation. Correlation is a short-term relationship regarding co-movements of prices. Correlation means that individual prices move together. Although correlation is relied upon by some traders, by itself it’s an untrustworthy tool.

On the other hand, cointegration is a longer-term relationship with co-movements of prices, in which the prices move together yet within certain ranges or spreads, as if tethered together. I’ve found cointegration to be a very useful tool in forex pairs trading.

During my forex pairs trading, when the spread widens to a threshold value calculated by my mechanical trading algorithms, I “short” the spread between the pairs’ prices. In other words, I’m betting the spread will revert back toward zero due to their cointegration.

Basic forex pairs trading strategies are very simple, especially when using mechanical trading systems: I choose two different currency pairs which tend to move similarly. I buy the under-performing currency pair and sell the out-performing pair. When the spread between the two pairs converges, I close my position for a profit.

Forex pairs trading based on cointegration is a fairly market-neutral strategy. As an example, if a currency pair plummets, then the trade will probably result in a loss on the long side and an offsetting gain on the short side. So, unless all currencies and underlying instruments suddenly lose value, the net trade should be near zero in a worst-case scenario.

By the same token, pairs trading in many markets is a self-funding trading strategy, since the proceeds from short sales can sometimes be used to open the long position. Even without this benefit, cointegration-fueled forex pairs trading still works very well.

Understanding cointegration for forex pairs trading

Cointegration is helpful for me in forex pairs trading because it lets me program my mechanical trading system based on both short-term deviations from equilibrium prices as well as long-term price expectations, by which I mean corrections and returning to equilibrium.

To understand how cointegration-driven forex pairs trading works, it’s important to first define cointegration then describe how it functions in mechanical trading systems.

As I’ve said above, cointegration refers to the equilibrium relationship between sets of time series, such as prices of separate forex pairs that by themselves aren’t in equilibrium. Stated in mathematical jargon, cointegration is a technique for measuring the relationship between non-stationary variables in a time series.

If any two or more time series each have a root value equal to 1, but their linear combination is stationary, then they are said to be cointegrated.

As a simple example, consider the prices of a stock-market index and its related futures contract: Although the prices of each of these two instruments may wander randomly over brief periods of time, ultimately they will return to equilibrium, and their deviations will be stationary.

Here’s another illustration, stated in terms of the classic “random walk” example: Let’s say there are two individual drunks walking homeward after a night of carousing. Let’s further assume these two drunks don’t know each other, so there’s no predictable relationship between their individual pathways. Therefore, there is no cointegration between their movements.

In contrast, consider the idea that an individual drunk is wandering homeward while accompanied by his dog on a leash. In this case, there is a definite connection between the pathways of these two poor creatures.

Although each of the two is still on an individual pathway over a short period of time, and even though either one of the pair may randomly lead or lag the other at any given point in time, still, they will always be found close together. The distance between them is fairly predictable, thus the pair are said to be cointegrated.

Returning now to technical terms, if there are two non-stationary time series, such as a hypothetical set of currency pairs AB and XY, that become stationary when the difference between them is calculated, these pairs are called an integrated first-order series – also call an I(1) series.

Even though neither of these series stays at a constant value, if there is a linear combination of AB and XY that is stationary (described as I(0)), then AB and XY are cointegrated.

The above simple example consists of only two time series of hypothetical forex pairs. Yet, the concept of cointegration also applies to multiple time series, using higher integration orders… Think in terms of a wandering drunk accompanied by several dogs, each on a different-length leash.

In real-world economics, it’s easy to find examples showing cointegration of pairs: Income and spending, or harshness of criminal laws and size of prison population. In forex pairs trading, my focus is on capitalizing on the quantitative and predictable relationship between cointegrated pairs of currencies.

For example, let’s assume that I’m watching those two cointegrated hypothetical currency pairs, AB and XY, and the cointegrated relationship between them is AB – XY = Z, where Z equals a stationary series with a mean of zero, that is I(0).

This would seem to suggest a simple trading strategy: When AB – XY > V, and V is my threshold trigger price, then the forex pairs trading system would sell AB and buy XY, since the expectation would be for AB to decrease in price and XY to increase. Or, when AB – XY < -V, I would expect to buy AB and sell XY.

Avoid spurious regression in forex pairs trading

Yet, it’s not as simple as the above example would suggest. In practice, a mechanical trading system for forex pairs trading needs to calculate cointegration instead of just relying on the R-squared value between AB and XY.

That’s because ordinary regression analysis falls short when dealing with non-stationary variables. It causes so-called spurious regression, which suggests relationships between variables even when there aren’t any.

Suppose, for example, that I regress 2 separate “random walk” time series against each other. When I test to see if there’s a linear relationship, very often I will find high values for R-squared as well as low p-values. Still, there’s no relationship between these 2 random walks.

Formulas and testing for cointegration in forex pairs trading

The simplest test for cointegration is the Engle-Granger test, which works like this:

  • Verify that ABt and XYt are both I(1)
  • Calculate the cointegration relationship [XYt = aABt + et] by using the least-squares method
  • Verify that the cointegration residuals et are stationary by using a unit-root test like the Augmented Dickey-Fuller (ADF) test

A detailed Granger equation:

ΔABt = α1(XYt-1 − βABt-1) +ut and ΔXYt = α2(XYt-1 − βABt-1) + vt

When XYt-1 − βABt-1 ~ I(0) describes the cointegration relationship.

XYt-1 − βABt-1 describes the extent of the disequilibrium away from the long-run, while αi is both the speed and direction at which the currency pair’s time series corrects itself from the disequilibrium.

When using the Engle-Granger method in forex pairs trading, the beta values of the regression are used to calculate the trade sizes for the pairs.

When using the Engle-Granger method in forex pairs trading, the beta values of the regression are used to calculate the trade sizes for the pairs.

Error correction for cointegration in forex pairs trading:

When using cointegration for forex pairs trading, it’s also helpful to account for how cointegrated variables adjust and return to the long-run equilibrium. So, for example, here are the two sample forex pairs’ time series shown autoregressively:

ABt = aABt-1 + bXYt-1 + ut and XYt = cABt-1 + dXYt-1 + vt

Forex pairs trading based on cointegration

When I use my mechanical trading system for forex pairs trading, the setup and execution are fairly simple. First, I find two currency pairs which seem like they may be cointegrated, such as EUR/USD and GBP/USD.

Then, I calculate the estimated spreads between the two pairs. Next, I check for stationarity using a unit-root test or another common method.

I make sure that my inbound data feed is working appropriately, and I let my mechanical trading algorithms create the trading signals. Assuming I’ve run adequate back-tests to confirm the parameters, I’m finally ready to use cointegration in my forex pairs trading.

I’ve found a MetaTrader indicator which offers an excellent starting point to build a cointegration forex pairs trading system. It looks like a Bollinger Band indicator, yet in fact the oscillator shows the price differential between the two different currency pairs.

When this oscillator moves toward either the high or low extreme, it indicates that the pairs are decoupling, which signals the trades.

Still, to be sure of success I rely on my well-built mechanical trading system to filter the signals with the Augmented Dickey-Fuller test before executing the appropriate trades.

Of course, anyone who wants to use cointegration for his or her forex pairs trading, yet lacks the requisite algo programming skills, can rely on an experienced programmer to create a winning expert advisor.

Through the magic of algorithmic trading, I program my mechanical trading system to define the price spreads based on data analysis. My algorithm monitors for price deviations, then automatically buys and sells currency pairs in order to harvest market inefficiencies.

Risks to be aware of when using cointegration with forex pairs trading

Forex pairs trading is not entirely risk-free. Above all, I keep in mind that forex pairs trading using cointegration is a mean-reversion strategy, which is based on the assumption that the mean values will be the same in the future as they were in the past.

Although the Augmented Dickey-Fuller test mentioned previously is helpful in validating the cointegrated relationships for forex pairs trading, it doesn’t mean that the spreads will continue to be cointegrated in the future.

I rely on strong risk management rules, which means that my mechanical trading system exits from unprofitable trades if or when the calculated reversion-to-mean is invalidated.

When the mean values change, it’s called drift. I try to detect drift as soon as possible. In other words, if the prices of previously-cointegrated forex pairs begin to move in a trend instead of reverting to the previously-calculated mean, it’s time for the algorithms of my mechanical trading system to recalculate the values.

When I use my mechanical trading system for forex pairs trading, I use the autoregressive formula mentioned earlier in this article in order to calculate a moving average to forecast the spread. Then, I exit the trade at my calculated error bounds.

Cointegration is a valuable tool for my forex pairs trading

Using cointegration in forex pairs trading is a market-neutral mechanical trading strategy that lets me trade in any market environment. It’s a smart strategy that’s based on reversion to mean, yet it helps me avoid the pitfalls of some of the other reversion-to-mean forex trading strategies.

Because of its potential use in profitable mechanical trading systems, cointegration for forex pairs trading has attracted interest from both professional traders as well as academic researchers.

There are plenty of recently-published articles, such as this quant-focused blog article, or this scholarly discussion of the subject, as well as plenty of discussion among traders.

Cointegration is a valuable tool in my forex pairs trading, and I highly recommend that you look into it for yourself.

Source: Cointegration in Forex Pairs Trading 

[adrotate banner =”70″]

About the Author
Eddie Flower has more than thirty years of trading experience and market insight regarding stocks and derivatives in U.S. and foreign markets. Now semi-retired from a career in financial services, he remains active as an independent trader, financial analyst and writer for and

Related Posts

Leave a Reply