Cointegration and FX Trading
Cointegration and FX Trading
Cointegration and FX Trading
Forex pairs trading strategy that implements cointegration is a sort of convergence trading strategy
based on statistical arbitrage using a mean-reversion logic. This strategy was first introduced by
Morgan Stanley in the 1980s using stock pairs, but traders found that it could be used in FX trading as
well.
If two pairs are cointegrated, it means that the spread between those pairs is about to converge over
time based on an empirical study. It doesn’t necessary that that divergence is about to stop anytime
soon, however some investors consider that it may be time to act, attempting to buy one pair and sell
the other and waiting for a convergence to happen. Unless the co-movements between the two
currencies break over time, the ‘net’ trade should be zero in the bad scenario (excluding the trading
costs).
It has been described as a profitable strategy, so the goal of this research is to review the cointegration
in the FX market using three different approaches – Engle-Granger, Johansen test and the Hurst
exponent – with some application in Eviews and Bloomberg.
One fundamental property that pairs trading requires is the instruments have to be cointegrated in
order to ensure a connection between two FX currency pairs.
If n = 2 for instance, the time series y1t and y2t are said to be cointegrated (co-moving as integrated
series) with co-integrated (first order) parameter b if the same b holds for both equation in the VAR(1)
process below:
Giving y1t and y2t two series (currency pairs), we have the following equation:
1. Δy1t and Δy2t were both I(0), i.e. y1,t and y2,t were both I(1); and
2. We could find a coefficient b such that
y1,t-1 – b y2,t-1~ I(0),
So the two side of the equation are balanced in the form I(0) = I(0) + I(0)
If we look at two currency pairs y1t and y2t, with y1t – y2t = Zt and Zt equals a stationary series with a
zero means. Then we can set up a threshold T such as:
- If y1t – y2t is greater than T, I take a short position in y1t and long y2t
- If y1t – y2t is lower than –T, I go long y1t and short y2t
I. Engle-Granger approach
We can use a variety of tests for cointegration, but the easier one is the Engle-Granger test:
Step 1
Step 2
3. Verify that the cointegrated residuals et are stationary by using a ADF (Augmented Dickey-
Fuller test) unit root test.
In case you fail to reject this test fail to reject the null hypothesis of a unit root against the
autoregressive alternative, you will need to construct a model containing only first
differences.
Cointegration means that the two time series co-move together in the long term, therefore cannot
drift apart very much [and for too long] from each other (Granger, 1981). We are now going to apply
this method to a few currency pairs using three different software (Eviews, Stata and Matlab)
1. Descriptive statistics: The period under observation runs from 31 December 2002 to 21 July
2016 and covers the daily exchange rates of the US-Dollar expressed in foreign currencies (i.e.
how many units of US dollars for 1 unit of Euro). Overall, the nine most important exchange
rates in the world are used: the Euro (EUR), the Japanese Yen (JPY), the British Pound (GBP),
the Swiss Franc (CHF), the Swedish Krona (SEK), the Norwegian Krona (NOK), the Australian
Dollar (AUD), the New Zealand Dollar (NZD) and the Mexican Peso (MXN). All daily rates are
converted by taking the natural logarithm. The data is extracted from Bloomberg using
PX_LAST as a field.
2. Unit Root Tests: Before we can carry out the cointegration analysis, we must apply unit root
tests to all exchange rates (in natural logarithm). As we precise earlier, we expect that the
order of integration is one as many academic studies have shown (e.g. Meese and Singleton,
1982). We will apply different unit root tests such as Phillips-Peron (PP) test, the KPSS-test by
Kwiatkowski et al. (1992) and the DF-GLS test by Elliott et al. (1996) to the exchange rates (log)
and in first difference.
Test on a few currency pairs
1. EURUSD and GBPUSD
FX Literature has usually suggested to look at EUR/USD and GBP/USD as a Forex pairs. If we plot the
chart of EURUSD and GBPUSD over the past ten years (see chart 1), we can see that both series are
kind of co-moving together. The only period where the regime shifted was during the Great Financial
crisis; the British pound plummeted by 36% against the US Dollar whereas EURUSD saw a 23%
drawdown during the same period.
2.0
1.8
1.6
1.4
1.2
1.0
03 04 05 06 07 08 09 10 11 12 13 14 15 16
EUR GBP
Eviews application:
First step: Estimate the regression using a simple OLS regression (log terms).
Once we uploaded the data on Eviews, we can proceed to the regression by using Estimate Equation
in the Quick Menu. As it is indicated in the equation specification, we enter the equation and chose
the Least Square method (which should be the method set by default).
The results of our regression are shown in Table 1. We can see that the statistics are highly significant
(C(1) represents the constant and C(2) is the Beta of the explanatory variable GBP). Therefore, we can
conclude that the [log] EUR exchange rates can be explain by the [log] GBP exchange rates.
Table 1. Results Simple OLS regression of equation 1
Now we are going to find out if there is a possible cointegration between the two time series using
the Engle-Granger approach. We know have to test if the residuals are stationary. Therefore we have
to create a new object in Eviews (Right click on the workfile, type of Object: Series), which we are
going to name Residuals. Then, in command, all you need to do is type Residuals = resid, which will
‘copy paste’ the values in the object resid into the new object residuals. The reason we do that is
because resid is an object that Eviews creates by default, and therefore we cannot work directly with
that object.
Now that we have the values in a different object (Residuals), we are going to do a unit root ADF
(Augmented Dickey-Fuller) test. To do so, double click on Residuals, click on View and select Unit Root
Test.
The results of the Unit Root Test are shows in Table 2. Unfortunately, we can see that the ADF statistic
is not significant enough, therefore the residuals of regression 1 are not stationary. As you can it
below, the ADF statistic becomes significant if we differentiate the time series once.
Table 2. Unit Root Test on Residuals
However, we noticed from chart 1 that there was a structural change during the financial crisis, and a
more interesting approach would be to use the Least Square with Breakpoints method that Eviews
offers us in the estimation settings. When we select that method, we also have to change the
maximum breaks to 1 in the options (as we can only notice 1 structural change). We can now rerun
the regression, and the results are shows in Table 3.
First, we can notice that the break happened in January 1st 2008 (in the beginning of the GFC, as we
wanted), and that the coefficients are all statistically significant for the two sample. We are now going
to find out if the residuals are stationary this time (don’t forget to rerun residuals = resid in the
command again).
Table 3. Results of the OLS regression 1 with 1 Break
And this time, the residuals are stationary (Table 4), meaning that the two currency pairs are ‘co-
moving’. The cointegration beta (that we called b in regression 1) decreased from 0.965 in the first
sample to 0.888 in the second sample.
e t = EURUSD t – (a + b * GBPUSD t)
We are now going to plot the residuals using the Bloomberg HS Spread Analysis function (picture 1).
On Bloomberg’s Terminal, type EUR Curncy GBP Curncy HS and press GO. As you can see below, you
then need to change the two coefficients: Mult (or b) = 0.888 and Const (a) = -0.14. The chart on the
bottom shows you the spread analysis (the residuals for us), and you can observe that there are usually
within fluctuating within a range of [-0.15; 0.15].
Now that we showed that the two currency pairs are cointegrated (using Engle-Granger approach),
we now have to determine a Long/Short signal for our strategy. One good thing about Currency pairs’
trading is that you are not that exposed to a potential bullish or bearish developing trend on a specific
currency pair based on aggressive loose actions run by a central bank (Japan increasing QE size, or Fed
starting a tightening cycle). By using this statistical ‘arbitrage’ strategy on EURUSD and GBPUSD, we
are exposed to three different countries, which is better for diversification.
There are several signals we could use to build up a strategy based on those results. First of all, we
need to decide if the signal is going to be static or ‘stochastic’. I believe that using a time varying based
on implied volatility leads to better results. You would have two moving bands:
When the spreads (or residuals) exceed the Positive Band (i.e. > 0.10), Short the spread, and when the
spreads go below the Negative Band (i.e. -0.15), long the spread. When you long (resp. short) the
Spread, you are basically going Long (resp. short) 1 unit EURUSD and Short (resp. long) 0.88 unit of
GBPUSD. Now, it is to the trader’s choice to go for stochastic/time-varying or static Bands.
We will now do the same exercise for the Aussie (AUD) and the Kiwi (NZD), two similar commodity-
linked economies. If we first plot the two exchange rates (chart 2), we can see that the two currencies
have been also co-moving over the past decade, with a kiwi that has always been lower than the Aussie
(vis-à-vis the US Dollar).
1.1
1.0
0.9
0.8
0.7
0.6
0.5
0.4
02 03 04 05 06 07 08 09 10 11 12 13 14 15 16
AUD NZD
We go through the same steps, and we found out that the residuals of the OLS method (without
breaks) are also non-stationary; the statistic that we get is -2.345 and is higher than the 10-percent
critical value. Despite the weakness of the Engle-Granger method with breaks, we will retest one more
time to see the results on these two currencies.
Table 5. Unit Root Test on Residuals (Regression with 1 Break)
If we use the LS method with Breaks (we include 1 Break as we did for EURUSD and Cable), we can
now that the statistic becomes significant at a 1-percent level.
Table 6. Results of OLS regression with 1 break (coefficients on the left and the unit root test on the
right)
This method is quite straightforward and depend on the choice of the dependent variable; its principal
strength is that it is very easy to use based on observable data, however many academics have
criticized this model due as the results can come from spurious regression. The simulation results of
Gregory et al. (1996) show the power of the Engle-Ganger test of the null hypothesis of no
cointegration is dramatically reduced when there is a break in the cointegration relationship.
Therefore, we will later see that to overcome this problem, we will use the Gregory and Hansen test
developed in 1996 that allow for breaks in either the intercept or the trend and intercept of the
cointegrating relationship.
As we are dealing with an arbitrary amount of input series (10 different currency pairs), we are now
going to introduce the Johansen Tests for Cointegration, which could be seen as the multivariate
generalization of the augmented Dickey-Fuller test G. Dwyer, 2015).
The Johansen test approaches the cointegration test by examining the number of independent linear
combination for n time series. If there are n variables which all have unit roots, then there will be at
most n-1 vectors that co-move together. In our cases, that would be at most 9 cointegrating vectors.
We first start by expressing the following vector autoregressive (VAR) model of order p
where yt is a n x 1 vector of variables that are integrated of order 1 (i.e. equivalent to I(1)) and et+is an
n x 1 vector of white noises. By sustracting A1 yt-1 +, this whole VAR can be written in the Error-
Correction form as follows :
𝑝−1
This representation is also known as the Vector Error Correction Model (VECM) form of the VAR(p).
The term П 𝑦𝑡−1 is referred as the long-run part or the equilibrium correction of the model (why we
are interested in : is there any cointegration between the 10 currency pairs ?). On the other hand, the
other part of the equation defines the short-term adjustments and the Г𝑖 are also called the short-
term parameters.
Suppose C=0 (no constant or deterministic trend). Mathematically, we can say that the VAR is stable
if:
det(IK – A1 z - … Ap zp) <> 0 for |z| ≤1
In other words, if all the roots of the determinantal polynomial are outside the complex unit circle.
Otherwise, if the polynomial has a unit root, which is to say det(IK – A1 z - … Ap zp) = 0 for z =1, the
matrix П is singular (no cointegration).
In Suppose now that the matrix П has a rank of 𝑟𝑘(П) = 𝑟, 𝑤ℎ𝑒𝑟𝑒 0 < 𝑟 < 𝑛. We said there are n
vectors of variables, therefore we have at most n-1 co-integrating relations. Then, as Helmut Lutkepohl
specifies in Econometric Analysis with Vector Autoregressive Models, nit is know (matrix theory) that
there exist (n x r) matrices α and β with ranks rk(α) = rk(β) = r such that 𝑟𝑘(П) = 𝛼𝛽′ .
If we multiply (𝛼 ′ 𝛼)−1 𝛼 ′ we showed that 𝛼𝛽′ 𝑦𝑡−1 is I(0) and that there are r linearly independent
cointegration relations among the components of 𝑦𝑡 .
They are two tests conducted by the Johansen test, the trace test and the eigenvalue test, where the
higher the rank (and/or the eigenvalues) the more indenpendent cointegration relations. We are now
going to use the Johansen test for our case study.
For this part, I decided to run a Johansen test for Cointegration on three commodity currencies – the
Mexican Peso (MXN), the Nowergian Krone (NOK) and the Australian Dollar (AUD). We are going to
use the same methodology as before and carry out unit root test of logarithmic price of those
exchange rates, then look if there is a potential long-term stability relationship between these
logarithmic prices.
Table 7 shows the result of the ADF and PP tests on each currency ; we can notice that the three time
series have the same result of existing unit root and obeying random walk with ADF and PP tests (i.e.
the three variables are I(1)).
Table 7. Unit root tests (ADF and PP) on MXN, NOK and AUD (log prices)
The results of the Johansen’s maximum likelihood trace test are on Table 8. The Johansen
cointegration test result shows there is to exist cointegration relationship among the currencies (long
term relationship). The value of Table 8 shows the first null hypothesis is refused under the significant
1-percent level (i.e. there exists a relationship between the three economies).
Indeed, those three countries are highly relying on commodity prices, therefore their currencies tend
to co-move with the commodity cycles. Over the past few years, the end of the super-cycle (shrinking
demand in commodities) has dramatically impacted the three currencies.
The Hurst exponent is a measure of persistence or long memory and could be used to define if a time-
series is trending or mean reverting. Its computation returns a value between 0 and 1, and the closer
the value is to 0.5 the more random the time series has behaved historically (i.e. the underlying time
series is a Geometric Brownian Motion).
If its value H < 0.5, then we tend to say that the series is mean reverting, whereas the series is trending
if H > 0.5.
For instance, if we compute the Hurst Exponent on the EURUSD FX returns, we should get a value
close to 0.5 as the FX returns should follow a random walk (Rogoff and Meese, 1983: RW model
forecasts exchange rates better than economic models).
The capital market theory is based on the assumption that security prices are martingales, which
implies that the expected value of security price is the price in the previous period. Security prices
follow random walks and returns from financial securities are unpredictable from past observations
(weak-from Efficient Market Hypothesis).
If we calculate the Hurst exponent using the Hurst function developed in matlab (R. Weron, see file),
we get values superior to 0.9 using the log prices, and we get values around 0.5 using the returns. This
tells us that EURUSD (log) trends whereas EURUSD ret is a Geometric Brownian Motion.
Note that trading literature is conflicted as to the usefulness of Hurst exponent, however it could be
interesting to add it in you research when you are testing if the residuals are stationary. Once you
discovered two cointegrated time series, include the H exponent to see if the spread usually returns
to zero if it diverge too much.
For instance, popular pair trading stocks in the equity market would be:
The Half Life of the mean reversion tells us how long it takes to prices (log) to revert to the series’
mean and therefore measure the quality of stationarity. It is access using the stochastic differential
equations known as Ornstein Uhlenceck process (mean reverting process), which take the following
formula:
Applying Ito’s Lemma, we get the following analytical solution for the expected value of y(t):
𝜇
𝐸[𝑦(𝑡)] = 𝑦0 𝑒𝑥𝑝(𝜆𝑡) − (1 − 𝑒𝑥𝑝(𝜆𝑡))
𝜆
We know that 𝜆 is negative for a mean-reverting process, and the expression above tells us that the
𝜇
expected value of the price decays exponentially to the value − 𝜆 with the half-life of decay equals to
log(2)
− 𝜆
.
If we get a positive value for 𝜆, prices do not mean revert and we should move on to a new
strategies. If we get 𝜆 = 0, then the half-life will be very long and the mean reverting (converging
spreads ) will be non-profitable over time. Note than Half life can also be used as a stop loss
criterion; if a spread hasn’t hit its exit target within the period given by the half life, we would then
exit the trade. This can ‘tell’ us if the relationship between two currency pairs or securities (stocks
pair, yield spreads) has changed.