1 Introduction

Pair trading is a technique often used by practitioners to predict short-term price movements and detect arbitrage opportunities. It searches for statistically linked asset pairs and any mis-pricings that can be exploited through arbitrage trading until the divergence in prices disappears.

This paper develops a new pair trading method to detect inefficiencies in exchange rate dynamics and arbitrage opportunities that is based on a convergence/divergence indicator (CDI) belonging to the oscillatory class. The proposed technique is applied to 11 exchange rates over the period 2010–2015, and trading rules based on CDI signals are obtained. The suggested approach is of general interest and can be applied to different financial markets and assets.

The basic idea is as follows: the degree of correlation between financial assets varies over time, and can be very high in certain periods. For example, the average correlation between EURUSD and AUDUSD in 2015 has been higher than 0.9 at the daily frequency, and in the range [0.8–0.9] if considering hourly intraday data, but at times the hourly correlation has dropped below 0 and even below \(-\)0.5 before reverting to “normal” values. We investigate the reasons for such abnormal situations in the case of the FOREX market using a convergence/divergence indicator (CDI) and show its efficiency in comparison to other popular methods.

The layout of the paper is as follows. Section 2 briefly reviews the literature on technical analysis. Section 3 describes the data and outlines the methodology. Section 4 presents the empirical results, while Sect. 5 offers some concluding remarks.

2 Literature Review

Forecasting asset price movements is a challenging task. According to the Efficient Market Hypothesis (EMH—see Fama 1970), prices should follow a random walk. However, several studies have tried to detect exploitable profit opportunities which would constitute evidence of market inefficiencies. Statistical arbitrage is a very popular trading strategy that was first used by Morgan Stanley in the 1980s (see Gatev et al. 2006 for details). It can be described as follows: the investor selects a pair of assets for which the mean spread between prices is relatively constant, and in case of deviations from this value he keeps selling one asset and buying the other till the spread reverts to its equilibrium level; then opened positions are closed.

This method was subsequently analysed in academic studies (Burgess 1999; Bondarenko 2003; Hogan et al. 2004, etc.), mainly for stock markets (Hong and Susmel 2003; Nath 2003; Gatev et al. 2006; Perlin 2009; Do and Faff 2010; Avellaneda and Lee 2010; Broussard and Vaihekoski 2012 and others). There is plenty of evidence that pair trading allows to generate abnormal profits in various financial markets, for instance in the US (Gatev et al. 2006) and Finnish (Broussard and Vaihekoski 2012) stock markets. This approach was further investigated by Enders and Granger (1998), Vidyamurthy (2004), Dunis and Ho (2005), Lin et al. 2006 and Khandani and Lo (2011) among others. A variety of methods have been used for statistical arbitrage, including: cointegration analysis; correlation analysis; regression analysis; neural networks; pattern recognition methods; factor models; subjective approaches (when the trader/investor selects pairs based on their fundamentals or other characteristics which make them “similar”—see Vidyamurthy 2004 for details).

Standard cointegration tests (see Engle and Granger 1987; Johansen 1988) are frequently carried out to devise trading strategies based on long-run linkages between asset prices. However, these might not be particularly useful in the presence of structural change. For instance, the correlation between oil and EURUSD was \(-\)0.7 in 2005, but 0.9 in 2007–2008, the average for the period 2005–2008 being in the 0.7–0.8 range. Clearly, statistical arbitrage based on cointegration analysis will not work in such a case. In fact Capocci (2005) found that during the financial crisis of 2007–2009 funds employing a pair trading strategy did not perform well. One possibility is to use in periods of instability the Kalman filter (see Dunis and Shannon 2005). The alternative is correlation analysis focusing on the short-run statistical properties of asset prices (see Alexander and Dimitriu 2002).

Once profitable trading strategies become well-known to the financial community, they cease to generate profits (see Chan 2009). Indeed Gatev et al. (2006) have shown that returns from pair trading strategies have been declining over time. Thus, it is important to develop new techniques, which is the aim of this paper.

3 Data and Methodology

Correlation analysis is a very popular method in financial markets, especially in stock markets (the degree of correlation between the S&P 500 and Dow Jones indices is higher than 0.9), less so in the FOREX market because linkages between currency pairs are much more volatile, as can be seen in Figs. 1 and 2 in the case of EURUSD and AUDUSD in 2014.

Fig. 1
figure 1

Daily data, EURUSD, 2014

Fig. 2
figure 2

Daily data, AUDUSD, 2014

However, this was not the case in 2013 (see Figs. 3, 4).

Fig. 3
figure 3

Daily data, EURUSD, 2013

Fig. 4
figure 4

Daily data, AUDUSD, 2013

Annual correlations are reported in Table 1.

Table 1 Correlations between EURUSD and AUDUSD in 2004–2014

As can be seen, the two series are generally positively and strongly correlated, but their correlation can suddenly become negative as it did in 2013, when it dropped to \(-\)0.41. Correlations for other financial assets are reported in Table 2, which confirms that from time to time divergence can occur [more information about correlations between financial assets can be found in Plastun and Kozmenko (2011)]. The question arises whether this type of information can be used to predict future price movements.

Table 2 Correlation analysis for different financial assets in 2005 and 2008

In this paper we focus on exchange rate dynamics. Having discussed the cases of the EURAUD and AUDUSD rate as an example, we then move on to the remaining rates.

Let us consider first the dynamics of EURUSD and AUDUSD over the period 20–23 February 2015 (see Fig. 5). The daily correlation between the two series was more than 0.9 (see Fig. 6) and positive, but on 20 February, at 8pm prices started to move in the opposite directions, before converging again on 23 February at 3am. Specifically, the hourly correlation dropped to \(-\)0.8 before reverting a few hours later to its “typical” range 0.8–0.9 (see Fig. 7).

Fig. 5
figure 5

Hourly price dynamics of EURUSD and AUDUSD on 20–23 February 2015

Fig. 6
figure 6

Daily correlation between EURUSD and AUDUSD in February 2015 (period 90)

Fig. 7
figure 7

Hourly correlation between EURUSD and AUDUSD on 20–23 February 2015 (period 12)

The biggest negative hourly correlation (\(-\)0.96) occurred at 2pm on 20 February, the daily correlation being instead strongly positive (0.9—see Table 3 for details). During this period EURUSD fell and AUDUSD rose. This would suggest that a trader should buy EURUSD at 1.1313 and sell AUDUSD at 0.7841 till the anomaly disappears (at 3am on 23 February), and then any open positions should be closed by closing EURUSD at 1.1386 and AUDUSD at 0.7834. This generates a profit of \(+\)0.65 % for EURUSD and \(+\)0.09 % for AUDUSD, and therefore an aggregate profit of \(+\)0.73 %.

Table 3 Data for analyzing the anomaly which appeared on 20.02.2015

Let us consider next the EURAUD dynamics in the period 20–23 February 2015 (see Fig. 8). EURAUD dropped sharply in the early morning of 20 February, but reverted to a more typical value a few hours later.

Let us see how this was reflected in the hourly correlation between EURUSD and AUDUSD (see Fig. 9): this dropped to \(-\)0.8 from its daily average of \(+0.9\), which suggests that double correlation (daily and hourly) analysis as a criterion for convergence/divergence can be useful to detect “fake” price movements.

Specifically, we propose first to measure the average correlation using daily data over different time periods (30, 60, 90 days etc.—the correlation could change significantly)—we define this “slow” correlation. Values higher than 0.5 indicate synchronisation. Then we use as an indicator of convergence/divergence the correlation coefficient computed with intraday data—the “fast” correlation. A degree of “slow” correlation above 0.5 combined with one of “fast” correlation below zero can be interpreted as a clear signal of divergence, which implies that positions should be opened. When after some time the degree of “fast” correlation reverts back to that of “slow” correlation, then open positions should be closed.

Figure 10 shows that the shorter the period is, the more volatile daily correlation is.

The same is true of hourly correlation (see Fig. 11).

Such anomalies are not specific to the EURUSD and AUDUSD co-movement, but can be detected, for instance, in other cross-currency pairs such as EURGBP, CHFJPY etc. As a tool for easy detection of such divergence/convergence situations (“fake” price movements) we propose to use a new Convergence/Divergence indicator (CDI) of the oscillatory type, programmed using the MetaQuotes Language 4 (MQL4). This is a language for programming trading strategies built in the client terminal. The syntax of MQL4 is quite similar to that of the C language. It allows to programme trading robots that automate trade processes and is ideally suited for the implementation of trading strategies; it can also check their efficiency using historical data. These are saved in the MetaTrader terminal as bars and represent records appearing as TOHLCV (HST format).

Fig. 8
figure 8

EURAUD dynamics on 20–23 February 2015

The trading terminal allows to test experts by various methods. By selecting smaller periods it is possible to examine price fluctuations within bars, i.e., price changes will be reproduced more precisely. For example, when an expert is tested on one-hour data, price changes for a bar can be modelled using one-minute data. The price history stored in the client terminal includes only Bid prices. In order to model Ask prices, the strategy tester uses the current spread at the beginning of testing. However, a user can set a custom spread for testing in the “Spread”, thereby approximating more accurately actual price movements.

Fig. 9
figure 9

EURAUD dynamics and hourly correlation between EURUSD and AUDUSD (period 24) on 20–23 February 2014

Fig. 10
figure 10

Dynamics of daily correlation between EURUSD and AUDUSD during 2014 (periods 30, 60 and 90)

Fig. 11
figure 11

Dynamics of hourly correlation between EURUSD and AUDUSD during 2014 (periods 12, 24 and 36)

The algorithm for CDI is as follows:

  1. 1.

    The daily correlation with period 90 (default value) is calculated

  2. 2.

    The hourly correlation with period 24 (default value) is calculated

  3. 3.

    Different colours are used to display them.

The results are shown in Fig. 12 (this is a screenshot from MetaTrader 4).

Fig. 12
figure 12

Indicator CDI (screenshot from the MetaTrader 4 trading platform; the price is shown in the top half and the Indicator in the bottom half of the chart)

The indicator consists of two lines:

  • Red line—it shows the daily correlation dynamics (the period can be set by the user, the default value is 90);

  • Blue line—it shows the hourly correlation dynamics (here the default value for the period is 24).

More lines can be added (see the red line in the indicator window) to help interpret the divergence zones.

The inputs of CDI are presented in Fig. 13 (screenshot of the input parameters of CDI from MetaTrader 4).

Fig. 13
figure 13

Input parameters of CDI (screenshot from the MetaTrader 4 trading platform)

4 Testing the CDI

Preliminary testing is carried out to determine the basic parameters of the indicator to detect the divergence/convergence zones (the sample is 2010). The results of the optimization of hourly correlation (in order to find the entry and exit criterions to open and close positions) are presented in Fig. 14.

Fig. 14
figure 14

Testing results for the convergence/divergence parameters. Axis X—Hourly correlation value (it should be multiplied by \(-\)1) for anomaly detection (extreme level of divergence). Axis Y—Hourly correlation value for detecting the disappearance of the anomaly (convergence level)

The darker the green is, the better the trading results are. As can be seen, the following intervals for hourly correlation can be used as basic parameters for convergence/divergence:

  • Divergence—[(\(-\)0.5) to (\(-\)0.7)];

  • Convergence [0.3–0.6].

In the next round of testing we search for the most appropriate periods for the daily and hourly correlation calculations. The results are presented in Fig. 15.

Fig. 15
figure 15

Testing results for the daily and hourly correlation periods. Axis X—daily correlation period. Axis Y—hourly correlation period

As can be seen the best periods are:

  • for daily correlation: [60–90];

  • for hourly correlation: [12–20].

We carry out both within-sample (2010) and out-of-sample (2011–2015) testing (for the full sample results, 2010–2015, see Appendix 1) using the following parameters: daily correlation period = 90, hourly correlation period = 12, divergence criterion = \(-\)0.5, convergence criterion = 0.5, criterion of “equality” of assets daily correlation \(>\)0.7.

4.1 CDI Versus RSI

Next we compare the performance of CDI to that of the Relative Strengthen Index (RSI—one of the most popular indicators of the oscillatory type) in the case of the EURAUD pair during 2010–2014. For RSI we build standard trading algorithms: sell in the overbought zone (when the RSI value is 70 or above), buy in the oversold one (when the RSI value is 30 or below). Positions should be closed in the opposite zone. Short positions are closed near the oversold zone, when the RSI value reaches 40, long positions in the overbought zones, when the RSI value reaches 60. The period is 14, as recommended for the RSI indicator by its developer [see Wilder (1978)]. The CDI trading parameters are as follows: daily correlation >0.7, hourly correlation \({<}-\)0.5 (for open), hourly correlation >0.5 (for position close). The daily correlation period is 90, and the hourly one is 12.

We trade 0.1 standard lot (this is trade size; it represents 100,000 units of currency used to fund the trading account). The minimum deposit for this volume is USD200, but we use a USD10000 deposit to cover all possible losses during testing and to avoid possible margin calls because of lack of money (in the case of unprofitable trading, there may be insufficient funds to trade and as a result the testing process could be stopped).

Detailed test results for CDI and RSI are presented in Appendices 1 and 2, whilst some key results are displayed in Table 4.

Table 4 Testing results for RSI and CDI: case of EURAUD 2010–2014

It can be seen that CDI generates 20 times less signals than RSI, but leads to profits 77 % of the times. RSI exhibits the main problem of oscillatory indicators: in the case of a trend they generate losses, and should be used only with additional trend indicators. CDI manages to avoid this trap by detecting “fake” price movements. Of course it is impossible to generate 100 % profitable trades because the daily correlation is not 1, and also there are losses if market behavior changes when the correlation begins to fade. Therefore it is necessary to carry out additional checks to make sure that the daily correlation during the last few days was not falling constantly.

4.2 Trading Rules

The above analysis suggests adopting the following trading rules:

  1. (1)

    positions should be opened in zones of divergence;

  2. (2)

    positions should be closed in zones of convergence;

  3. (3)

    to open trading the daily correlation should be \(>\)0.7;

  4. (4)

    the daily correlation during the last few days should have been increasing;

  5. (5)

    positions should be opened in the opposite direction to “fake” movement (a “fake” price movement occurs when there is divergence)

Fig. 16
figure 16

Illustration of CDI trading rules work in practice (screenshot from MetaTrader 4)

An example is shown in Fig. 16.

A divergence situation in the EURAUD dynamics appeared on 26 January 2015. The hourly correlation dropped below \(-\)0.5, whilst the daily correlation was \(>\)0.8. At 8am CDI generated a signal for opening a long position at 1.4150. The divergence disappeared at 11pm when the hourly correlation reached +0.5; at that time the position should be closed at 1.4330. The net profit from trading would then exceed 1 %.

4.3 Empirical Results

Next we extend the analysis to check the robustness of the results. Specifically, we consider the most liquid currency pairs in the FOREX, i.e. EURUSD, GBPUSD, USDCHF, USDJPY, as well as some rather liquid ones such as USDCAD and AUDUSD, the so-called commodity pairs. Their combinations give the following cross rates: EURGBP, EURAUD, EURJPY, EURCHF, EURCAD, GBPAUD, GBPJPY, GBPCHF, AUDCAD, AUDJPY, CHFJPY. The sample period is 2010–2015.

As a first step, we carry out simple correlation analysis. Values of the correlation coefficient >0.7 are defined as high correlation. Detailed results are presented in Appendix 3 Figs. 1727. A summary is provided in Table 5.

Table 5 Results of the correlation analysis (period 60), 2010–2015

As can be seen, the degree of correlation varies considerably across pairs. The following analysis is carried out for the following ones: EURGBP, EURAUD, EURJPY, EURCHF, EURCAD, GBPAUD, GBPJPY, GBPCHF, AUDCAD, AUDJPY, CHFJPY.

The sample period for the obtaining the optimal parameters is 2010–2012. Out-of-the-sample testing is conducted for 2013, 2014 and 2015. The final testing of the overall procedure is continuous testing for the 2010–2015 period.

For the optimisation procedure over the period 2010–2012 the slow correlation (based on daily data) equals 60 and the fast one 12 (based on hourly data). We used the slow correlation period 60 instead of 90 to obtain a bigger number of deals. The main criterion to choose the best performer is total net profit (financial result of all trades—it represents the difference between “Gross profit” and “Gross loss”), total trades (total amount of trade positions), profit factor (the ratio between total profit and total loss in per cents). A value of one implies that total profit is equal to total loss. The expected payoff is the average profit/loss factor of one trade. It also measures the expected profitability/unprofitability of the next trade and drawdown (the maximum drawdown being related to the initial deposit).

The results of the optimisation procedure are presented in Table 6.

Table 6 Optimisation results: period 2010–2012

As can be seen, the optimal parameters in most cases generate profits. However, this could be the result of data snooping, and therefore out-of-sample tests should be done before reaching any conclusions. The “optimal parameters” are used for out-of-sample testing (2013, 2014, 2015). The results are presented in Table 7.

Table 7 Out-of-sample testing results: periods 2013, 2014, 2015

As can be seen, the results are rather unstable and confirm our suspicion of data snooping affecting the optimization over the period 2010–2012. Nevertheless we also conduct the overall testing analysis (see Table 8).

Table 8 Overall testing results: period 2010–2015

The results are consistent with the previous ones, suggesting that data snooping possibly occurs in the case of GBPCHF, EURJPY and AUDCAD. Therefore additional tests are needed.

With the aim of establishing whether the trading results are statistically different from the random trading ones we carry out t-tests. We chose this approach instead of z-test because the sample size is less than 100. A t-test compares the means from two samples to see whether they come from the same population. In our case the first is the average profit/loss factor of one trade applying the trading strategy, and the second is equal to zero because random trading (without transaction costs) should generate zero profit. In order to provide results which are closer to the real world we also incorporate the spread (as the biggest component of transaction costs) in the random trading results. This implies that the average profit per deal in random trading is not 0, but equals the size of the spread.

The null hypothesis (H0) is that the mean is the same in both samples, and the alternative (H1) that it is not. The computed values of the t-test are compared with the critical one at the 5 % significance level. Failure to reject H0 implies that there are no advantages from exploiting the trading strategy we test, whilst a rejection suggests that a trading strategy focusing on the convergences/divergences in exchange rate dynamics can generate extra profits and therefore can be used to predict prices.

As an illustration, the complete trading results for the EURAUD in 2015 are presented in Appendix 4. The t-test results are reported in Table 9.

Table 9 Example of t-test for the EURAUD results in 2015

As we can be seen, H0 is rejected, which implies that the trading results of EURAUD in 2015 are statistically different from the random ones and therefore the trading strategy is effective. The Overall testing results for the periods 2010–2012; 2013; 2014; 2015; 2010–2015 are presented in Table 10.

Table 10 Overall testing results: periods2010–2012, 2013, 2014, 2015, 2010–2015

Most of the trading results fail the test, i.e. they are not statistically different from the random ones, and therefore the trading strategy cannot beat the market. The two exceptions are EURAUD and AUDJPY: in these two cases a trading strategy based on the convergence/divergence indicator generates profits, providing at least some evidence in favour of its effectiveness.

Future research will consider extensions of the present analysis, namely the estimation of GARCH and stochastic volatility (SV) models, Kalman filtering etc. instead of simple correlation analysis; the use of more sophisticated software for the testing procedures and programming the trading robots, such as Mathlab or R instead of MetaTrader; refinements of the trading algorithm, checking for the absence of daily correlation drop, incorporating “trend detection”, doing additional checks before the position opening; performing White’s Bootstrap Reality Check test and Hansen’s Superior Predictive Ability test instead of simple t-tests and z-tests.

5 Conclusions

In this paper we develop a new approach to detecting inefficiencies in exchange rate dynamics based on double correlation analysis of financial asset dynamics. Daily correlations are taken to represent the “normal” behavior of asset prices, whilst hourly correlations are used to detect divergence/convergence and devise appropriate trading strategies.

The general rule is as follows: if the daily correlation between two assets is higher than 0.5–0.7, they are considered to be diverging if their hourly correlation is lower than \(-\)0.5 and converging if it is higher than 0.5. On the basis of this rule we construct a new technical indicator (convergence/divergence indicator or CDI), which visualises both types of correlation (daily and hourly) and provides the user with information about the current state (divergence/convergence); divergence is defined as an inefficiency in price movements. This indicator is shown to outperform other indicators of the oscillatory class and to generate profits (in the case of the EURAUD pair) without the need for incorporating additional algorithms in the trading strategy. Testing of the trading strategy based on CDI rules shows that in general it cannot beat the market. However, there a few exceptions (EURAUD and ADUJPY) providing at least some evidence supporting the profitability of such a trading strategy.