Detecting correlations and triangular arbitrage opportunities in the Forex by means of multifractal detrended cross-correlations analysis

Multifractal detrended cross-correlation methodology is described and applied to Foreign exchange (Forex) market time series. Fluctuations of high-frequency exchange rates of eight major world currencies over 2010–2018 period are used to study cross-correlations. The study is motivated by fundamental questions in complex systems’ response to significant environmental changes and by potential applications in investment strategies, including detecting triangular arbitrage opportunities. Dominant multiscale cross-correlations between the exchange rates are found to typically occur at smaller fluctuation levels. However, hierarchical organization of ties expressed in terms of dendrograms, with a novel application of the multiscale cross-correlation coefficient, is more pronounced at large fluctuations. The cross-correlations are quantified to be stronger on average between those exchange rate pairs that are bound within triangular relations. Some pairs from outside triangular relations are, however, identified to be exceptionally strongly correlated as compared to the average strength of triangular correlations. This in particular applies to those exchange rates that involve Australian and New Zealand dollars and reflects their economic relations. Significant events with impact on the Forex are shown to induce triangular arbitrage opportunities which at the same time reduce cross-correlations on the smallest timescales and act destructively on the multiscale organization of correlations. In 2010–2018, such instances took place in connection with the Swiss National Bank intervention and the weakening of British pound sterling accompanying the initiation of Brexit procedure. The methodology could be applicable to temporal and multiscale pattern detection in any time series.


Introduction
Dynamics of complex systems, which are typically described by many degrees of freedom and a nonlinear internal structure, as well as their specific response to significant changes in the environment are within a research focus of many areas in fundamental and applied sciences, including mathematical, physical, biological and economic sciences [1]. The present study of complexity in a system behavior is focused on the financial market with multicale signatures of its response to some major events influencing currency exchange rates.
The foreign exchange financial market (known as the Forex or FX market) is a global market for currency trading in continuous operation 24 h a day except for weekends (10 pm UTC Sunday-10 pm UTC Friday). According to the recent foreign exchange statistics published by the Bank for International Settlements, the averaged daily trade volume exceeded 5 trillion US dollars in April 2016, with currencies mostly traded including US dollars, euros and Japanese yens (see- [2]). This huge volume makes the Forex market the biggest in the world of finance and serves just as a single parameter illustrating its enormous complexity [3].
Seminal papers elucidating intricate complex dynamics of the foreign exchange market on short timescales include turbulent cascade approach [4], motivated by hierarchical features in hydrodynamics of turbulence, as well as those referring to multi-affine analysis of typical currency exchange rates [5] and also their sparseness and roughness [6]. The Forex market determines currency exchange rates between any traded pair of currencies through a complex and nowadays mostly machine-driven automatic system of multiple type transactions among different kinds of buyers and sellers round-the-clock. Most recent works on uncovering patterns in foreign exchange markets include, but are not limited to, studies of lead-lag relationships [7], scaling relationships [8], multifractality and efficiency issues [9,10], partial correlations [11] or quote spreads in high-frequency trading [12].
The Forex market is highly liquid market due to its massive trading and asset volume. Typically, it exhibits small daily fluctuations of currency exchange rates. Nevertheless, the value of one currency is determined relative to the value of the other currency through the exchange rate. Any information or event having impact on one currency value will propagate through the Forex market by means of adjusting various other exchange rates, which could be envisaged as a sort of local (pairwise) currency interactions which eventually should influence globally all the currencies traded in the Forex market. Therefore, we may expect that occasionally, a significant fluctuation or even a temporally significant change in one exchange rate of any pair due to whatever reason will propagate to remaining pairs of currencies depending on the degree of cross-correlations between quotes for different currency pairs. Such influence should be particularly strong when comparing exchange rates of currencies with a common, the so-called base currency. Any temporal discrepancy between exchange rates for such two pairs of currencies, with one currency in common, would offer immediately an opportunity to make a profit just by means of using this window of opportunity due to favorable exchange rates. It is the so-called triangular arbitrage opportunity [13][14][15][16].
However, in reality we deal with enormous amounts of data flowing at very high rates in the Forex market and elsewhere. Matching buy-sell transactions may typically occur during milliseconds via automated trading systems [17]. Such enormous amounts of data have to be effectively analyzed for promising patterns down to a level of small fluctuations over small timescales. Big data, data mining, machine learning, artificial intelligence, and an algorithmic high-frequency trading are in focus of quantitative finance [18]. Attempts to predict changes in financial time series from correlationbased deep learning have been quite promising [19]. Recently, a novel predictive framework for forecasting future behavior of financial markets has been proposed by [20]. Artificial intelligence may benefit a great deal from financial applications and social sciences alike [21]. Hence, financial market studies are of interest from fundamental and practical point of view for a wide community of scientists, engineers and professionals, bringing together many branches of mathematics, physics, economy and computer sciences to address some challenging issues.
The main research problem addressed in this paper is the following: to what extent bivariate cross-correlations on the Forex market at various levels of fluctuations of exchange rates and timescales ranging from tens of seconds up to weeks may provide important information about a possibility to observe disparities in exchange rates, which may offer potential arbitrage opportunities.
Our goal is to demonstrate prediction power of the so-called q-detrended cross-correlation coefficient stemming from the multifractal formalism when applied to historical time series of exchange rates for a set of currencies. We will investigate in detail sensitivity of various statistical properties of small and large fluctuations using natural scalability of our cross-correlation measure and follow closely the way how information and events related to financial markets may build arbitrage opportunities among a set of currency exchange rates.
We would like to emphasize that our method based on detrended cross-correlation analysis is quite novel and only recently a plethora of applications started to emerge across many fields of nonlinear correlations studies, including meteorological data [22], electricity spot market [23], effects of weather on agricultural market [24], stock markets [25], cryptocurrency markets [26], electroencephalography (EEG) signals [27], electrocardiography (ECG) and arterial blood pressure [28] as well as air pollution [29,30]. Such wide interest across different fields of research in application of detrended cross-correlation analysis to nonlinear time series studies serves as an additional strong motivation for elucidating such analysis in terms of its potential and limitations.
The paper is organized as follows. First, we discuss the Forex data used in the present study and our methodology for the financial times series of logarithmic returns for exchange rates. Next, we discuss a degree of triangular arbitrage opportunity in a form of a convenient coefficient derived from suitable exchange rates. Then, we describe fundamental concepts of our statistical methods, which stem from multifractal formalism. We define q-dependent detrended coefficient capturing cross-correlations of two detrended time series. The results section comprises global behavior of currency rates, logarithmic return rates statistics with the focus on large fluctuations, discussion of hierarchy among currency exchange rates and the role of abrupt crosscorrelation changes and large fluctuations in detecting arbitrage opportunities. Finally, we summarize and draw some general conclusions. In view of the abovementioned interdisciplinary research by other authors [22,24,25,[27][28][29][30], through the conclusions from our present work, we would like also to support advantages of multifractal detrended cross-correlation method and its wide applications to study any time series with nonlinear correlations, not only in the foreign exchange market but also across other fields of pure and applied sciences.

Data and financial time series methodology
The data used in the present study have been obtained from the Dukascopy Swiss Banking Group [31]. The data set (see "Appendix") comprises foreign exchange rates for the period 2010-2018 between pairs of 8 major currencies. For the purpose of this study, we consider the arithmetic average out of the bid and ask price for each exchange rate: Then, we consider the following time series of logarithmic returns of such exchange rates for each pair of currencies: which are then processed as described in "Appendix."

Triangular arbitrage in the Forex market
Let us first consider a model situation where we can instantly carry out a sequence of transactions with exchange rates, which all of them are known for a given time instance t. In our example, a subset of all exchange rates for 3 currencies (EUR, USD, CHF), namely 3 quotes EUR/CHF, EUR/USD, USD/CHF , is considered. Let us assume that a trader holds initially euros (EUR). One possibility to use arbitrage opportunity would be to do a sequence of transformations including those 3 currencies [13,14]: In this case, the rate product (we buy USD with EUR, then buy CHF with USD and finally sell CHF in return for EUR): If such a rate product α 1 > 0, then the arbitrage is possible, provided all transactions can be completed with such instant rates. That is we could end up with more currency EUR than we had initially. In practice, however, this is difficult on real markets and in fact after the first leg of such multiple transactions, remaining trades would not be possible to complete or the price will be changed by the time they will be completed.
Another alternative possible minimal exchange currency path in our case (again assuming all the transactions are done in the same time instance or with the frozen exchange rates) would be the following Its value in terms of the product of exchange rates will be the following (replicated by means of selling EUR for CHF, then selling CHF for USD and finally buying back EUR for USD): Including more currencies in our basket, we could consider longer exchange paths allowing to use more factors (appropriate exchange rates) in our α rate product coefficient. Again its value compared to one would indicate a theoretical possibility of executing arbitrage opportunity.

Multifractal statistical methodology
Let us consider multiple time series of exchange rates recorded simultaneously. We are interested in a level of cross-correlation between a pair of non-stationary time series, x(i) and y(i), where i = 1, 2, . . . , N corresponds to subsequent instances of time when the signals were recorded (t 1 < t 2 < · · · < t N ). Both time series are synchronized in time and have the same number N of data points.
Following the idea of a new cross-correlation coefficient defined in terms of detrended fluctuation analysis (DFA) and detrended cross-correlation analysis (DCCA)- [32], which has been put forward in [33], we use in the present study a multifractal detrended crosscorrelation analysis (MFCCA) [34] with q-dependent cross-correlation coefficient. The cross-correlations of stock markets have been also investigated with a timedelay variant of DCCA method [35]. Multiscale multifractal detrended cross-correlation analysis (MSMF-DXA) has been proposed and subsequently employed to study dynamics of interactions in the stock market [36]. Other methods, including weighted multifractal analysis of financial time series [37] and multiscale properties of time series based on the segmentation [38], allow for multifractal and multiscale nonlinear effects investigations.
Multifractal cross-correlations can also be studied using Multifractal Detrending Moving-Average Cross-Correlation Analysis (MFXDMA) as it has been done by [39] and within the wavelet formalism by making use of the Multifractal Cross Wavelet Transform (MF-X-WT) analysis performed by [40]. The approach adopted in the present study has been introduced by [41]. In what follows, we briefly state main points of this approach.

Detrended cross-correlation methodology
We define a new time series X (k) of partial sums of the original time series elements x(i). In an analogous way, the second time series of interest, Y (k), is obtained out of the original time series y(i). Depending on the nature of the signal, we may expect in time series trends and seasonal periodicities. In order to remove such trends at various timescales s (if data points are collected at the same time intervals t, the scale number s corresponds to the time), we subdivide both series of length N into a number of M(s) = int(N /s) non-overlapping intervals, each of length s (s < N /5), starting from one end of a time series. For a given timescale s, we may repeat the partitioning procedure from the other end of the time series, thus obtaining in total 2M(s) time intervals, each of which will contain s data points. For each of the interval k (k = 0, . . . , 2M(s) − 1), we find a polynomial of degree m, P (m) (s,k) , for a given timescale s (equivalent to the number s of used data point to perform the fit). In general, it could be a polynomial of any finite degree, depending on the nature of the signal. For the purpose of data analysis in this paper, we use polynomials of degree m = 2 unless otherwise stated [34]. Now we are ready to construct an estimate of the covariance of both newly derived time series, each of which has those polynomial trends removed interval by interval: If both time series are the same, we obtain an estimate of the detrended variance in the k-th interval from partitioning with the scale s. Constructed estimates of the covariance allow us to define a family of fluctuation functions F For q = 0, we use a formula for the computation of the fluctuation functions, which essentially follows from de l'Hospital rule [34,42].
The definition of the family of fluctuation functions given by Eq. (8) could be applied in principle also for the case when both time series are the same. In such a case, we obtain, as it should be, the q-th order fluctuation function, which follows from the multifractal detrended fluctuation analysis (MFDFA) for a single time series [42]. Multifractal cross-correlations for time series should manifest themselves as a power-law behavior of the fluctuation functions F (q) XY over a range of timescales s: The generalized q-dependent exponent, λ(q), provides the insight into multifractal properties of the cross-correlations. In the limiting case of λ(q) = const, that is in the case of the exponent being independent on q, we may infer the monofractal type of cross-correlations between the two time series x(i) and y(i). Again, in the case of x(i) ≡ y(i), the asymptotic behavior of the fluctuation function, as defined by Eq. (8), takes a form which is familiar from the MFDFA approach: where h(q) is a generalized Hurst exponent [42][43][44][45][46].

Detrended cross-correlation q-coefficient
The family of fluctuation functions of order q, defined by Eq. (8), convey the information about fluctuations of different order in magnitude over a range of timescales. Therefore, one can define a q-dependent detrended cross-correlation (qDCCA) coefficient using a family of such fluctuation functions [41]: The coefficient ρ q (s) allows to measure a degree of the cross-correlations between two time series x i , y i . It has been proven that the q-dependent cross-correlation coefficient is bounded: The definition of the cross-correlation given by Eq. (11) can be interpreted as a generalization of the Pearson coefficient [47,48]. Advantage of the coefficient ρ q (s) over the conventional Pearson index has already been studied through numerical methods in different contexts by several authors (see, e.g., [49] and references therein). The parameter q helps to identify the range of detrended fluctuation amplitudes corresponding to the most significant correlations for these two time series [41].
It has been established that for q > 2 large fluctuations mainly contribute to ρ q (s), whereas for q < 2 the dominant contribution is due to small-and mediumsize fluctuations [25,41]. Hence, by choosing a range of values in q we may filter out correlation coefficient for either small or large fluctuations.

Analysis and results
Based on the methodology described, we will investigate multiscale properties for cross-correlations among time series corresponding to currency exchange rates for the whole period 2010-2018 as well as for some sub-periods. We use MATLAB desktop environment for the numerical implementation of our methodology. Although we have quite large data sets (see "Appendix"), the implementation itself is quite straightforward and all the computations can be accomplished on a modern PC class computer. We also apply standard methods of MATLAB source codes validation and surrogate data checking against artefacts or robustness of nonlinear correlations within our data sets [41].
Although in our study we focus on different signatures and statistical properties of multivariate time series with respect to triangular arbitrage, one may envisage a broader picture of such analysis, whereby one would like to uncover a specific kind of crosscorrelations in these time series which would help us to detect underlying interconnections useful for the system behavior prediction in future.

Logarithmic returns and the inverse cubic law
In this subsection, we will present a general picture for the financial time series dynamics with an emphasis on events which have an impact on the Forex market.

A currency index
We define a currency index C I a for the currency a as an average out of cumulative log-returns for all exchange rates that have a as a base currency.
The C I a could be cast in the following form: where N = 8 in the present case and r (b/a, t) denotes time-dependent log-return for exchange rate b/a with label b ∈ {AU D, C AD, C H F, EU R, G B P, J PY, N Z D, U S D} such that it is different from the label a. The currency index given by Eq. (12) indicates performance of any given currency in terms of exchange rates to other currencies in our data sets. With such a single averaged characteristics, one may have a general overview of a global temporal behavior and performance of any currency in the Forex market.
In Fig. 1, currency indexes time variation is shown for all the currencies in our data set for the considered period 2010-2018. For this plot, we take logarithmic returns arising from average bid and ask exchange rates. In the figure, we have indicated some political or economic events on the timescale (with dotted vertical line) which in principle could have impact on the Forex market performance during that period of time. These labels may serve as an intuitive explanation of features observed on the curves related to the currency indexes. We have included some sudden events: the US stock market flash crash on May 6, 2010, Fukushima Daiichi (Japan) nuclear disaster unfolding during several days In general, one observes significant variations of considered currency indexes over the period of 8 years. Worth noting in this timeline are Swiss National Bank (SNB) interventions in 2011 and in 2015 as well as the Brexit referendum in 2016. In the following, we will explore in some more details statistical properties of the Forex market data in the vicinity of these events. We will discuss to what extent our proposed statistical analysis corroborates these features, when looking from the hindsight with the help of historical data from the Forex market.

Inverse cubic tails of absolute return distributions
Another interesting feature of the Forex market is related to the cumulative distribution of absolute logarithmic returns: In Fig. 2, we show such cumulative distributions for exchange rate absolute normalized returns among all major currencies considered in the present study. Each solid line of different color demonstrates the tail behavior for the corresponding currency. In this doublelog plot the black dashed line corresponds to the slope of γ 0 = −3, which is the so-called inverse cubic power-law [50][51][52]. The least "fat tail" corresponds to returns of the exchange rates EUR/USD, which typically form the most liquid pair of currencies in the Forex market. Significant deviations from the inversecubic law are clearly present for large absolute logreturns (|r t | > 10 2 for exchange rates involving CHF (Swiss franc)). The tails for the following exchange rates USD/CHF, EUR/CHF, GBP/CHF, NZD/CHF are significantly "fatter" than it would follow from the inverse cubic behavior We note that all currency exchange rates with the Swiss franc (CHF) as base currency yield higher prob-ability of larger absolute logarithmic returns than other exchange rates. These outliers could be attributed to two instances of the SNB interventions (in 2011 and 2015). In order to demonstrate the origin of these deviations, we remove from our data sets a period of a half an hour in the morning on January 15, 2015, when a significant volatility of currencies exchange rates has been observed in the wake of the SNB intervention [9]. The resultant tails of the probability distributions are shown in the inset of Fig. 2. Hence without this single, shorttermed event on the market, the tails of the distributions approximately follow the inverse-cubic behavior.

Multifractality and scaling behavior of cross-correlation fluctuation functions
We already know that the outliers of the cumulative distributions document an increased level of larger fluctuations in absolute log-returns. This means also a higher chance to encounter fluctuations yielding larger returns.
The question arises to what extent these fluctuations are cross-correlated among exchange rates. Such crosscorrelations at least between two exchange rate time series would offer a potential opportunity of triangular arbitrage. Let us begin by investigating an example of multifractal cross-correlations for time series in terms of cross-correlation fluctuation functions F XY (s, q). Figure 3 shows the results for a cross-correlation fluctuation functions between EUR/JPY with GBP/JPY and EUR/JPY with GBP/USD for exchange rates in a single, 2018 year.
In Fig. 3 (the main panel), each line in the bunch of lines corresponds to the fluctuation function F XY (q i , s) with 0.2(0.4) ≤ q i ≤ 4. We verify indeed that the scaling according to Eq. (9) is valid in the range 0.8 ≤ q ≤ 4 that is the slope of the line in the double-log plot is approximately independent on the scale s in the range shown. We may also observe that the fluctuation functions depend on the coefficient q for 1 q 4 though in this case that dependence is rather weak. Additionally, for the reference both insets in Fig. 3 show the average h XY (q) of generalized Hurst exponents for each individual time series. This average is defined as follows [53]: It is worth noting that in this shown example, the scaling of the fluctuation functions for the case of the triangular relation among two exchange rates (the top panel in Fig. 3) is much better preserved for small q parameters than this is the case for the exchange rates which are outside the triangular relation (the bottom panel).

Detrended cross-correlation q-coefficient in the Forex market
As a more quantitative extension of this analysis, we consider therefore some examples of the detrended cross-correlation q-coefficient ρ q (s) results for exchange rate series. Two examples of the crosscorrelation between two series of returns for exchange rates are shown in Fig. 4: the top panel presents a pair of EUR/JPY and GBP/JPY, whereas the bottom panel illustrates the results of ρ q (s) for EUR/JPY and GBP/USD. From the data shown in Fig. 4, it follows that the return rates for exchange rates EUR/JPY are markedly more correlated with the returns for exchange rates GBP/JPY than with the GBP/USD rate. This seems to be expected as in the former case there is a common (base) currency (JPY). In such a way, a pair of returns is intrinsically correlated by JPY currency performance due to the triangular constraint in the exchange rates. This is an example of cross-correlations among 3 currencies. In this case, the cross-correlations are in the triangular relation (the top panel of Fig. 4). In the case shown in the bottom panel of Fig. 4 illustrating a pair of returns for exchange rates EUR/JPY vs GBP/USD which includes 4 different currencies, there is no triangular relation among them. However, for both pairs of exchange rates (one of them pertains to the triangular relation, whereas the other one does not in the shown example) we observe that the larger size fluctuations are considered (the greater q value is taken), the smaller crosscorrelation in terms of the detrended cross-correlation q-coefficient ρ q (s) is observed over the timescale considered. The magnitude of this cross-correlation measure is weakly dependent on the timescale and only slightly grows with time. Its growth is more pronounced for larger fluctuations (cf. data for q = 4) than this is the case for smaller fluctuations (cf. q = 1).

Fluctuations of different magnitude and cross-correlations
Let us investigate in some more detail the crosscorrelations between relatively small and large fluctua- This gives an idea about the range of obtained values of cross-correlation coefficient distributions for the currency pairs which are in or out the triangular relation. One can easily verify that at the level of smaller fluctuations (q = 1) many pairs of logarithmic exchange rate returns, which are not linked by the triangular relation, could have a higher averaged cross-correlation coefficient than many pairs which have such property. The black dotted horizontal line on the top-left panel shows the average crosscorrelation of different pairs pertaining to the triangular relation. The value of that overall average is about 0.6.
Note that in the case of cross-correlations with no triangular relations between pairs of currencies including AUD and NZD we observe stronger correlations than in the case of pairs pertaining to the triangular relations (the top panel for q = 1). It indicates a possibility of observing stronger correlations in exchange rates among four currencies in comparison with what we would expect on average in the case of exchange rates linked with the triangular relations. This somewhat unexpected result could be ascribed to mechanisms coupling economies of these two countries.
Hence, from our study it follows that indeed some cross-correlations of the pairs, which are not linked by a common currency and are traded on the Forex market, may reach that overall average cross-correlation of exchange rates with a common base. This seems to be a surprising conclusion, since typically we would expect stronger correlations between explicitly correlated two series (by means of a common, base currency) rather than in a case where there is no such common base. However, we have to appreciate the fact that crosscorrelations between any pair of exchange rates will have some impact on the cross-correlations of other pairs through mutual connections arising from different combinations of currencies being exchanged. Nonetheless, the small fluctuations in logarithmic returns would be difficult to use in viable trading strategies, mainly due to finite spreads in bid and ask rates. From the practical point of view, correlations of large fluctuations seem to be more promising in finding and exploiting arbitrage opportunities. The bottom panels show the results for the large fluctuations (q = 4) in the corresponding cases of the exchange currency pairs which are in or outside the triangular relation (that is with a common currency or not). The order of currency pairs in the bottom panels is kept the same as in the top panels. For the case of the larger fluctuations, the level of overall average of cross-correlations is marked again with horizontal black dotted line at a value of 0.3 approximately for the case of triangular-related class of currency pairs. The cross-correlations of the large fluctuations are therefore approximately two times smaller than in the case of small correlations. However, in the case of GBP and CHF taken as the common base currency the cross-correlations are stronger for q = 4 than for q = 1. In the case of cross-correlations outside the triangular relations, the strong cross-correlations arise when we take AUD as base currency on the one side and NZD on the other.
It can be noticed that in general the cross-correlations for smaller fluctuations (q = 1) are stronger than crosscorrelations for the large fluctuations (q = 4). This is in agreement with previous findings [25,41,54] for other financial instruments like stocks and commodities. The time evolution of averaged cross-correlations over currency pairs with the common base for large fluctuations will be discussed later (cf. Fig. 8).

Dendrograms-agglomerative hierarchical trees from cross-correlations of exchange rates
As we have already seen, studying quantitative levels of cross-correlations may uncover some less obvious connections among currencies than just the explicit link through a common base currency. In order to uncover a hierarchy of currencies in terms of logarithmic returns from exchange rates, one may consider cross-correlation coefficients as a measure of the distance d(i, j) between different exchange rate pairs. We define the distance d(i, j) similarly to the definition introduced by [55], but instead of correlation coefficient, we use q-dependent cross-correlation coefficient [41,56]. Thus, the distance for agglomerative hierarchical trees takes the following form: It is worth noting that to the best of our knowledge, it is the first ever such use of the cross-correlation qcoefficient as a way to induce measure for creating a hierarchy tree (a dendrogram). As a result of adopting the distance given by Eq. (15), we obtain graphs for the small (q = 1) and for the large fluctuations (q = 4) as it is shown in Fig 6. For q = 4 (the bottom panel of Fig 6, the cluster structure is more pronounced than it is in the case of q = 1. In the q = 4 case, a well-separated cluster structure is formed with CHF (green), GBP (cyan), JPY (magenta), AUD and NZD (orange), while in q = 1 case we see mostly JPY (mangeta) and AUD/NZD (orange) with not so much hierarchical separation among various groups of currencies. An interesting observation follows that Australlian (AUD) and New Zealand (NZD) dollars are strongly correlated-they appear together in However, if two different currencies are strongly correlated, then they effectively behave like a common base and the appropriate cross-correlations may reveal themselves as an unexpectedly large value of the ρ q coefficient. Such findings are important when designing the trading strategies, both for optimizing portfolio and for its hedging. We would like to stress the fact that our method is not limited only to time series from the Forex and it may well be applied to the signals in a form of time series arising in other fields of research and applications.

Cross-correlations in multiple timescales
We have looked already into the cross-correlations within fluctuation magnitude domain. Let us now investigate the cross-correlations in the time domain. For that reason, we compute the detrended cross-correlation qcoefficient ρ q (s) in the case of four different timescales:  Fig. 7. The top four panels refer to the q = 1 case, whereas the bottom four panels illustrate the case of q = 4. In both cases, the cross-correlations are sorted in decreasing order of values obtained for the shortest timescale (s = 5 min). We sort ρ q (s) values for the shortest timescale and keep that ordering unchanged when taking longer timescales. We also show the overall average for the currency exchange rate pairs complying to the triangular relation (the black dotted line) and for currency exchange rate pairs which are not bounded by the triangular relation (red dotted line). The most striking feature when comparing the small and large fluctuation cross-correlations over different timescales is that in the former case little is happening over different timescales considered. The plots indicate nearly static cross-correlations, almost independent on the timescale for the small fluctuations. On the other hand, the cross-correlations for large fluctuations (q = 4) change with extension of the timescale s.
The magnitude of values ρ q (s) for currency exchange rates which are in triangular relation (black/left part of each panel) stay within the same range although the values themselves fluctuate significantly with a change of timescale. Specifically, the overall average (denoted by the black dotted horizontal line) grows from a value which is less than 0.3 (for s = 5 mins)) up to approximately 0.4 (for s ≥ 1) h. The growth of the overall average of cross-correlation is even more convincing for the class of pairs of currency exchange rates which are not in a strict triangular relation.
In general for q = 4 and longer timescales s (24 h, 1 week), we observe stronger cross-correlations within exchange rates, related by the triangular relationship, for the pairs where the Swiss franc (CHF) or the British pound sterling (GBP) is the common base currency. It is evident that the cross-correlations (red/right parts of each panel) obtained for s = 5 mins are much smaller than those corresponding to s ≥ 1 h.
What is more, for the shortest timescale shown here, the difference between cross-correlations for pairs that are in the triangular relations and those that are not, is the biggest. The cross-correlation for currency exchange pairs outside the triangular relation in the case of large fluctuations in logarithmic return rates grows in time, which indicates propagation of correlations in time. This explains why averaged crosscorrelations for such currency pairs may be unexpectedly high (cf. Fig. 5). This gives us some idea about the information propagation time through the Forex market, which is the time needed to reflect the maximum average cross-correlation between any pair of exchange currency rates. As we have already mentioned above, in the Forex market all currency rates are connected through mutual exchange rate mechanism. However, in some cases the inherently stronger correlations (e.g., induced by the triangular relationship) will result in a very fast response (so the crosscorrelations are significant after a relatively short time) whereas for some other exchange rates such response would be lagged in time (e.g. carried over through a sequence of exchange rate adjustments). This time lag could be regarded as an estimate for the time duration of window of opportunity to execute an arbitrage opportunity. It is interesting to note that this effect becomes more pronounced when longer timescales are implemented (24 h, 1 week). A similar conclusion is valid when considering GBP or JPY taken as the base currencycorresponding curves have a maximum in 2016. GBP was mainly influenced by Brexit and GBP flash crash, whereas JPY appreciation was caused indirectly by US elections. On the contrary, the increase in the average for CAD as the base can be noted only for the shortest timescale s = 5min in 2017. This could mean that the sudden overnight increase in the rates by the Bank of Canada in 2017 did not have longer lasting effect and was only causing very short term effect. In order to identify promising arbitrage opportunities (e.g. the triangular arbitrage), our tentative conclusion would be that we have to observe large fluctuations (by means of significant cross-correlation coefficients for q = 4) for relatively long timescale s.
In view of the above findings where we have already identified an important role of the large fluctuations, a question arises to what extent (even briefly occurring in time) such extreme events (fluctuations) in currency exchange returns may influence the detrended cross-correlations. In the following, let us investigate the impact of extreme events on the cross-correlations expressed by the ρ q (s) coefficient. In Fig. 1, we have seen possible influence of various events on the currency index. It is interesting to see how these extreme events manifest themselves as far as cross-correlations are concerned. The periods of extreme variation of exchange rates are shown in the corresponding insets of Fig. 9. In the case of the small fluctuations (q = 1, black solid and dotted curves), these periods of significant exchange rate variations do not have significant impact on overall behavior through a range of timescales s. However, the large fluctuations in the cross-correlations (q = 4, magenta solid and dotted curves) are highly sensitive to the existence of these well localized in time events. The insets show that in fact the exchange rates compared (red and black curves) were changing so rapidly that they could not follow each other. In such a way, the possible arbitrage opportunities have arisen.

Detecting triangular arbitrage opportunities
Finally, let us investigate closely these brief in time periods of arbitrage opportunities we have identi-  In this case, we use ask and bid prices for exchange rates (instead of averaged ones) in order to show this in more details fied by our data analysis. Figure 10 shows triangular arbitrage coefficient α 1 and α 2 (cf. Eqs.(4), (6)).
All events indicated by values greater than 0 in fact could potentially offer triangular arbitrage opportunities. The top panel shows an example of potentially significant arbitrage opportunity which is related to the SNB intervention in 2015 and fluctuations in the CHF exchange rates. The middle panel of Fig. 10 illustrates a moderate arbitrage opportunity, which is related to the Brexit referendum and its impact on the GBP exchange rates. Finally, the bottom panel illustrates rather weak chance of exploiting triangular arbitrage opportunity-there is only one very brief in time instance when in theory this might be possible. In such a way, we have shown that the inspection of cross-correlations by means of the ρ q (s) coefficient over a range of timescales s, especially for the large fluctuations (in our multifractal approach with the maximum value of the parameter q = 4 to ensure the convergence) allows to uncover the hierarchy in exchange rates and focus on the periods of time when arbitrage opportunities potentially exist. The arbitrage opportunities are very closely related to large fluctuations which tend to be more pronounced in the longer timescales s. This is the case for exchange rates related to CHF and GBP, and this is precisely what opens windows of opportunities for the triangular arbitrage.

Conclusions
We have investigated currency exchange rates crosscorrelations within the basket of 8 major currencies. Distributions of 10 s historical logarithmic exchange rate returns follow approximately the inverse cubic power-law behavior when the brief period of trading on January 15, 2015, in the wake of the SNB intervention is excluded from the exchange rate data sets. The tails of the cumulative distributions of the highfrequency intra-day quotes exhibit non-Gaussian distribution of the rare events by means of the so-called fat tails (large fluctuations). This clearly documents that large fluctuations in the logarithmic rate returns occur more frequently than one may expect from the Gaussian distribution.
We have found that on average the cross-correlations of exchange rates for currencies in the triangular relationship are stronger than cross-correlations between exchange rates for currencies outside the triangular relationship. Detrended cross-correlation approach with ρ q cross-correlation measure allows to uncover a hierarchical structure of exchange rates among set of currencies in the Forex market. To the best of our knowledge, it is the first ever application of the ρ q cross-correlation coefficient to the agglomerative hierarchical clustering in a form of dendrograms. Such dendrograms may have important applications related to hedging, risk optimization, and diversification of the currency portfolio in the Forex market.
The detrended cross-correlation coefficient ρ q is sensitive to timescales and fluctuation magnitudes allowing for a subtle (more sophisticated) crosscorrelation measuring than just a simple global estimates (e.g. the Pearson's coefficient). By using ρ q coefficients, one may discriminate subintervals of time series when significant changes in time of crosscorrelations are observed. Such abrupt changes of cross-correlations combined with the presence of relatively large fluctuations may signal potential triangular arbitrage opportunities. We have shown a viable possibility of such application using historical data for years 2015 and 2016, when a significant enhancement of correlations in exchange rate pairs involving CHF, GBP, JPY for large fluctuations (q = 4) has been observed with increasing the timescale s.
Finally, our conjecture is that during significant events (e.g. with an impact on the Forex market) one may expect existence of potential triangular arbitrage opportunities. Such events and the resultant opportunities indeed have been identified in the historical trading data for the period 2010-2018. The evidence we have shown clearly indicates that the multifractal cross-correlation methodology should contribute significantly to predictive modeling of temporal and multiscale patterns in time series analysis.
We believe that our present study, where we consider currencies interaction through their mutual exchange rates and the dynamics of the rates adjustment to a new conditions due to a sudden event, may encourage future research in studying the information propagation through complex networks of interacting entities. This in turn may have some consequences for design of new smart learning methods for neural networks and a general computational intelligence in predicting a future behavior of complex systems. For example, since we have demonstrated feasibility of financial time series analysis against favorable patterns, we may expect future advancement in computer algorithms for financial engineering when trading tick-by-tick data are available in real time.

Compliance with ethical standards
Conflict of interest The authors declare that they have no conflict of interest.
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http:// creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.

Appendix
The data used in the present study has been obtained from the Dukascopy Swiss Banking Group [31]. The data set comprises foreign exchange high-frequency bid and ask prices for the period 2010-2018 with the time interval t = 10 s. We consider exchange rates between pairs of the following 8 major currencies: Australian dollar (AUD), Canadian dollar (CAD), Swiss franc (CHF), euro (EUR), British pound sterling (GBP), Japanese yen (JPY), New Zealand dollar (NZD), and US dollar (USD).
Thus, we have in the data set all 28 exchange rates (bid and ask prices) among the set of 8 currencies. Hence, the foreign exchange rates are the following: The quotes have the meaning of indicative bid/ask prices rather than executable prices. The indicative and executable prices differ typically by a few basis points [13,14]. Bid/ask (buy/sell) quotes give the spread, that is a difference in prices at which one can buy/sell a currency. The ask price is greater than or equal to the bid price. The spread is dependent on the liquidity (a number and volume of transactions) as well as on some other factors.
We filter out such raw data (time series) by removing periods when for any given pair there was no quote available or no trading (e.g. weekends, holidays), which effectively resulted in the rate being unchanged. Typically, we thus have approximately 2.2 million data points per year and therefore this amounts to approximately 20 million of observations for each exchange rate time series.
We have used MATLAB by MathWorks numerical computing environment for implementing our time series methodology with the numerical analysis performed on a modern PC class computer. Validation methods included a simple model parameter variation as well as surrogate data methods. We can apply our procedure to randomly shuffled original data. We can also create Fourier surrogate time series. In the latter validation method, the Fourier transform of the original time series is computed and then the inverse Fourier transform is applied to the retained amplitudes, but randomly mixed phases [1,41].