Algorithmic and Mechanical Forex Strategies | OneStepRemoved

  • Articles
  • Sophisticated Web Sites
  • Automated Trading
  • Testimonials
  • Contact

Cointegration in Forex Pairs Trading

April 23, 2014 by Eddie Flower 21 Comments

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.

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.

 

Filed Under: How does the forex market work?, Uncategorized Tagged With: cointegration, cointegration calculations, forex pairs trading, mechanical trading

Pairs Trading – Entry Point Confirmation Using Technical Indicators

May 23, 2013 by Rupert Hadlow Leave a Comment

Trading pairs without adequate confirmation is like building a house without a structural engineer. In the short term the design may be stable and safe, however over a longer period of time, the sensitivity to weather conditions and other factors could be hazardous.

Systems that are based on one factor alone will invariably have a shelf life and will need to be retrained to accommodate shifts in market conditions. As discussed in our previous article on cointegration, the degree to which a trader does not adhere to these strict guidelines, can greatly affect his/her profitability.

Technical indicators for entry signals on a pairs trade

Some of the key technical indicators and patterns that can work well for confirming entry signals include the Relative Strength Index (RSI), Market Facilitation Index (MFI) and Candlestick charting. Each has a unique attribute, and can assist in defining key entry and exit points.

Relative Strength Index (RSI)

Although this is a relatively common indicator that does not stand the test of time by itself, the RSI can be an effective tool in pairs trading. Defined as the change in momentum, this technical indicator will range from 100 (extremely overbought) to 0 (extremely oversold). Traditionally the trigger points are 70 for a short and 30 for a long. With respect to pairs trading, this strength index allows the trader to confirm overbought and oversold scenarios.

RSI technical indicator

RSI shows how a technical indicator can be used to spot entry opportunities

  • Example:

The sppread between Gold and Silver is considerable, with the cointegration still above the required 80 mark (according to catalyst corner). The relative strength index has confirmed that silver is trading in the oversold bracket (at 75), providing the trader with a valid entry for a short position.

Market Facilitation Index (MFI)

Invented by technical analyst Bill Williams, the MFI identifies the momentum of a movement based on the volume. Depending on the strength of the buying and selling pressure, the indicator will price in an estimate of whether the trend is strong or weak.

Commonly used with longer time frames, the Market Facilitation Index is calculated by using the high, low and volume bars. Unlike RSI, the indicator is represented by a bar graph with coloration. Green highlights strong volume and momentum, whilst blue, brown and light brown indicate indecisive volume reactions. In pairs trading, the MFI can identify long term momentum patterns and which cross to buy or short.

Included below is a table from Wikipedia, which visually highlights the degree to which an adjust in volume can influence the market facilitation index.

The money flow index shows stuff

The money flow index uses basic bar information to create a colored graph

Source: Wikipedia,2013

  • Example:

Gold has crossed below silver on a linear regression basis. The Market Facilitation Index however has indicated that volume and momentum are rising, and there will be a rebound in the price. The trader would look at going long gold and short silver.

Candlesticks

Candlesticks are an extremely efficient way of determining the trend of a price. Different patterns defined by the open high low and close price can supply the trader with efficient entry and exit points. From a pairs trading point of view, it is important to only open a position based on a strong buy or sell pattern. Bullish signals include a piercing pattern, inverted hammer, morning star and abandoned baby. For more information on each of these patterns it is recommended to visit www.stockcharts.com

  • Example:

During the month of April, the spread between Gold and Silver is relatively tight. A morning star formation appears on the Gold price, indicating a potential bullish reversal. The trader in this case, would open a Long Gold, Short Silver to capitalize on a sudden breakout in the price.

Filed Under: Trading strategy ideas Tagged With: candlestick charting, cointegration, market facilitation index, pairs trading, RSI

Pairs Trading Case Study: Gold / Silver

May 20, 2013 by Rupert Hadlow 3 Comments

Finding a pair of currencies or commodities that can stand up to the cointegration test on both a short term and long term basis can be quite difficult. It is common for pairings to have some degree of distance or long term deviation away from the linear regression and this can greatly affect performance.

Several high profile market neutral hedge funds have been victim to this regression breakout. Long Term Capital Management (LTCM) is the most famous example. The fund lost several billion dollars in 1998 during the Russian financial crisis. Nearly every position in its bonds and derivative pairings went off the rails all at the same time.

Trading pairs is not full proof and strict risk management and cointegration retraining must be implemented. As discussed in our previous posts on correlation and cointegration, we are looking for the degree to which two variables will return to their common mean. This will determine our entry and exit strategy, and where we will place our stops.

In one of our previous articles – ‘Analysing Pairs with Correlation and Cointegration’, we identified Gold and Silver as a good potential trading pair due to its statistically high long term percentage levels. We calculated the cointegration using a free tool from the website – Catalyst Corner www.catalystcorner.com.

Download the tools for MetaTrader 4.

30 Day Correlation: 94.98%
2 Year Correlation: 26.99%
13 Year Correlation: 95.3%
2 Year Cointegration: 85%

Pairs trading with silver and gold

Silver (Black) Gold (Orange Green) 30 Minute Chart

Setting up Charts

Setting up a pairs template in MetaTrader is relatively simple and requires two free indicators (these have been included with the tutorial). The first indicator is that of the FX Correlator and the second is the overlay chart. Highlighted below are the step by step instructions on adding each to your chart.

1. Open Metatrader and Choose Chart
2. Drag the Overlay Chart onto the open chart window, and specify default settings. Click OK.
3. Attach the FX Correlator to the chart, click INPUTS and change all currencies to FALSE except for USD and AUD. The reason why we are keeping these two as TRUE is outlined in the trade setup section. Click OK.

Trade Setup

You will now see two indicators positioned on the chart window. The top overlay chart will highlight the price of silver in comparison to gold. You will notice that the general trend direction is quite similar (correlation), however there are points along the timeline where the prices widen and then regress (cointegration). These are the points that we are looking to profit from.

The FX correlator is a unique indicator that calculates a spread between the main chart window and specified other crosses. When we added the indicator to the chart, we only specified the AUD and USD currencies. Hence we can only see two coloured linear regression points along the time line. The reason we chose the Aussie dollar, was because of its susceptibility to commodity prices movements and the US dollar is the natural base cross with Gold and Silver.

Trading Opportunities:

• Long Gold and Short Silver when the USD crosses above the AUD on the FX Correlator.
• Short Gold and Long Silver when the USD crosses below the AUD on the FX Correlator.

In the diagram above, we have circled a number of trade setups. On the 14th of May at 4:00, the USD crossed higher than the AUD, triggering a potential Short Silver/Long Gold scenario. According to the chart, Silver regressed back to the mean and overlapped Gold at 12:00. The second possible trade scenario occured on the 15th of May at 20:00. As the AUD crossed above the USD, a Long Silver / Short Gold trade was triggered with the spread widening.

Risk Management

• Tight Stops on both crosses
• Calculate the correlation and cointegration of Gold and Silver regularly (daily basis). If the cointegration breaks down (below 80%) do not trade.
• Position size should be based on underlying value and may not be equal.

Filed Under: How does the forex market work?, Trading strategy ideas Tagged With: cointegration, fx correlator, overlay chart, pairs trading gold silver

Charting a Linear Regression

May 16, 2013 by Rupert Hadlow Leave a Comment

Linear Regression can be an effective tool when defining the overall momentum or trend of a series of prices. It can be adapted to all data. Fields outside of trading, including risk management and statistics, use the same statistical technique. Insurance providers will commonly plot the relationship between claims and age groups to determine premium levels.

To put it into perspective, if there were five people in a group who each owned two television sets, one person who owned no tv and two people that owned four tv sets, then the linear regression on a rough basis would indicate the trend is just slightly above the two sets. The standard error or deviation in this case would be the two outside samples of no tv and four televisions.

Can regression be an effective tool for trading on a longer term basis or is it too susceptible to market volatility and future pricing? To understand how linear regression really works, we need to chart the channel and its standard deviation levels.

The first tutorial below looks at a scatter graph in excel and how to plot a linear regression. Please note that it does not include the standard deviation channels.

Charting a Simple Regression in Excel

  1. Open your Metatrader platform and click on TOOLS, HISTORY CENTER.
  2. Choose the relevant pair for your regression analysis. Once you have chosen the time frame, click on EXPORT and SAVE the spread sheet.
  3. Open the spread sheet and highlight the two relevant columns you would like to use in the scatter chart. In the diagram above we used time (minutes) and price.
  4. Click INSERT and choose SCATTER. A drop down menu will appear. To get a true reflection, click on SCATTER WITH ONLY MARKERS.
  5. A chart will appear with dots representing the distribution of pricing data. To decipher the linear regression, highlight the chart and click on LAYOUT in the excel menu.
  6. Navigate to TREND LINE. A drop down menu will appear with several options. Choose LINEAR TREND LINE. The regression line will now appear.
Excel linear regression on EURUSD M5 data

Excel draws a linear regression of the EURSUD prices using data from MetaTrader M5 charts

As discussed previously, the excel chart will only give a basic trend and will not supply the user with detailed standard deviations. It is also recommended that you do not highlight too much data for a realistic short term interpretation.

We specified eight hours of five minute data on the EURUSD cross in the above diagram.

Charting Linear Regression in Metatrader

  1. Open the desired chart and time frame in Metatrader
  2. Click on INSERT and CHANNELS. You will then be provided with a list. Choose LINEAR REGRESSION.
  3. Hold down your left mouse button and drag the linear regression over the desired time period. In the above diagram, we chose a linear regression with a starting date of the 13th May at 10:30.
  4. You will notice that the regression line will appear and adjust according to the data. One standard deviation will also appear.
  5. If you would like a second deviation channel on your chart, navigate back to the top of the terminal menu and click on INSERT – CHANNELS and choose Standard Deviation. You will then need to drag the standard deviation channel using your left mouse button and specify the same time period.
A linear regression of the EURUSD

MetaTrader interprets the price movements and draws a liner regression

Recommendation

It is recommended when trading using regression, that you specify a shorter range so as to manage the volatility. As prices shift, so will the channel, and profit potentials could quickly turn to losses.

It is important to always keep stops tight in case of violent swing backs in the price.

Filed Under: How does the forex market work?, Trading strategy ideas Tagged With: charting standard deviations, cointegration, correlation and pairs trading, linear regression

Correlation vs. Cointegration

May 6, 2013 by Shaun Overton Leave a Comment

Correlation and cointegration are two regression based concepts that are commonly misused by the trading community. Complex in their formulation, both are inter related and are used to calculate the relationships between two or more products (ie commodities, forex, stock prices) over a specific time period.

Correlation

A value of +1 (positive correlation) or -1 (negative correlation) is assigned based on the how efficiently the two prices react to each other. Correlation identifies pairs that move in either tandem or opposing directions.

A good example of a long term correlation pairing is that of the EURUSD and the USDCHF crosses, which trade in a similar direction. On the other side of the coin, the EURGBP and the AUDNZD trade in opposing directions. They show a negative correlation of -0.81.

Although this figure indicates that the crosses moved against each other, there is a slight degree of uncertainty over the long term sustainability of this negative result. Professional traders commonly set the entry benchmark for pairs above or below 0.9 or -0.9.

Correlation does have a significant drawback, which can greatly affect profitability. Although two pairs may be correlated, they are still not in complete unison, which can cause a slight drift in the prices. In the case of the EURGBP and the AUDNZD, it is a drift -0.19.

Read the post on forex correlation for more details on the topic.

Correlation

Image credit: Vassia Atanassova
The left box shows a strong correlation. The middle shows a weak correlation. The far right shows an image with no correlation.

Cointegration

Cointegration analyses the movements in prices and identifies the degree to which two values are sensitive to the same mean or average price over a given time period. It doesn’t say anything about the direction that the pairs will move. Cointegration only measures whether or not the distance between them remains stable over time.

If we look at gold and silver, for example, we may find that they track a common average value. They may trade in opposite directions from day to day. At some unknown point in the future, they should revert back towards that average and hence they are cointegrated. Hedge funds commonly use this formula to program statistical arbitrage models to identify pairs to trade.

Another important factor to keep in mind is the look back period of the mean and standard deviation. In essence, if you make the look back value 700, then the regression channel will calculate what the average price is over 700 periods. This can be too inefficient and will limit the sensitivity to changes in the market dynamic.

On the other hand, if you set a short look back period, then it will cause a whipsaw effect and will be far too sensitive. It is important to get a balanced look back within the range of 200-350.

Gold and sliver chart show correlation and cointegration

Gold / Silver Example

• Top Section: Standard Deviation and Linear Regression
• Middle Section: Relative Performance Gold (dark blue) and Silver (light/ turquoise blue)
• Bottom Section: Gold Daily Chart and Time Line

The above chart highlights the overall correlation of Gold and Silver and the degree to which breakouts could trigger trade opportunities. I have circled a number of different cointegration scenarios and referenced these on the second section with P1, P2, P3 and P4 labels.

Silver Spike – March

A significant spike in the price of Silver in March sent the linear regression value below the lower standard deviation channel of -2.0. To capitalize on the significant discrepancy in prices, the trader would have looked at shorting silver and going long gold. Performance wise, this would have resulted in an overall profit as silver weakened heavily, crossing below gold in May.

Silver Oversold – July

The silver price continues to weaken on a relative level to gold. In June and July, the regression value passes above the top standard deviation channel, indicating that silver is oversold and the price will have to revert back to its mean. The trader decides to open a long position in silver and short gold. As forecast, it returns to its mean and the gap between both spot prices closes quickly.

Silver Overshoots – December

Once again the silver price overshoots gold. This sets up a long gold, short silver opportunity. On a performance level, the trader would capitalize on
the spread and profit from the position.

Silver Selloff – April

Puncturing the second standard deviation channel, the gold price stabilises whilst silver weakens heavily. This has now supplied the trader with a long
silver, short gold opportunity.

Filed Under: Trading strategy ideas Tagged With: cointegration, correlation, gold, silver

Forex Correlation

November 9, 2011 by Shaun Overton Leave a Comment

Correlation strategies appeal to forex traders because it removes the stress associated with picking market direction. When two correlated pairs diverge from one another, the idea is to simply buy one pair and sell the other.

What are correlated currency pairs?

Correlation offers a mathematical probability of two “time series” moving in the same direction. Applying the idea to forex, it means that we need to pick two currency pairs. EURUSD and USDCHF are two popular choices due to their extremely high correlation, so we’ll use those.

Now we ask a simple question: “If the EURUSD rises, what is the probability of that the USDCHF will also rise”? Our calculations will pump out a simple a number between -1 and +1. +1 means that that if Currency A rose in value, then it is 100% certain that Currency B rose in value. -1 means that if Currency A increased in value, then it is 100% certain that Currency B decreased in value. A value of 0 means that the movement of Currency A exercises no effect at all on Currency B.

Traders generally consider a correlation significant whenever the number is greater than 70%. EURUSD and USDCHF are so popular because they hold the strongest correlation among the major currency pairs. When market volatility was very low a few years ago, it was around -93%. Today, the correlation tends to hang around -80%. The European debt problems and Swiss National Bank’s intervention have a lot to do with the decrease in this number. Their trading relationships are far less stable.

Risks of correlation strategies

Let’s move back into familiar territory with my favorite example, the moving average. If you take the average over the past 20 bars, you know from experience that the average will differ if you study a 50 period versus a 200 period average. If you look at the average on a 5 minute chart versus an hourly chart, the number will vary yet again.

The take-away here is that the correlations work the same way. The correlation between EURUSD and USDCHF might even be positive if you look at a short enough time scale. As you back away in time, you will notice that the further out you go, the more steady the correlation numbers look. If the weekly correlation of the EURUSD and USDCHF is -80%, you would expect the numbers to get more wild and erratic as you scale all the way down to a tick chart.

The same problem with the moving average also appears. Studying the correlation over 50 periods provides a responsive number, but it is also far less consistent than the 200 period correlation. What a short period gains in responsiveness, it loses in stability.

You should also consider whether the correlation that you’re studying makes fundamental sense. Just because the temperature change in Mongolia predicted the direction of USDJPY for the past week does not make it a good idea to use in the future. The same goes with pair trading.

EURUSD and USDCHF should be highly correlated for two reasons. They both contain the same currency in the pair (USD), which half weights them with the same instrument. Additionally, the EUR and CHF both have strong trading relationships with the US. You would expect both the Euro Zone and Switzerland to share a need for buying and selling US dollars. They need them for buying oil, importing and exporting to the US, etc. Anyone with a cursory understanding of macroeconomics could explain why this relationship makes sense.

Correlation traders typically settle on pairs that share a common currency. The EURUSD and USDCHF trade both share the US dollar. When you buy EURUSD and buy USDCHF, you are really:
Buying EUR and selling USD
Buying USD and selling CHF

Notice that the USD cancels itself out. What you are really doing is buying EUR and selling CHF. This is commonly known as the EURCHF pair. Assuming that the spread is not outrageous, it makes more sense to simply buy or sell EURCHF directly rather than going through the convoluted process of managing two open trades.

If you decide to pursue the two pair approach, you must consider the need to balance the trade sizes against each other. Using standard lots as the example, 100,000 EUR is 137,500 USD. 100,000 USD is 90,900 CHF. If you buy one standard lot of EURUSD, you are buying $137,500 of it. When you buy a standard lot of USDCHF, you are only buying $100,000.

$137,500 obviously does not equal $100,000. Unless you intentionally decided to trade different sizes, you may want to consider equalizing them.

Solve for x:
€100,000 / $137,500 = x * (₣90,900/$100,000)
x = €100,000 / ₣90,00 * $100,000 / $137,500 = 0.803
You would need your EURUSD trade to be 80% of the size of the USDCHF trade.

What correlation is not

Correlation only provides insight into the probability of direction. It says absolutely nothing about the strength of a particular move. A few months ago the USDCHF climbed 1,000 points in value within a single day. The EURUSD only moved a few hundred pips. The USDCHF moved dramatically further than the EURUSD both in terms of pips, but more importantly, as a percentage of price.

Consider if you were short EURUSD that day and short USDCHF. You lost a ton of money. On the flip side, if you were long EURUSD and long USDCHF, then you got lucky and earned the move. Regardless of what happened, correlation told you nothing about the outcome when they move in the same direction. For that reason, I prefer looking at a less intuitive method called cointegration.

Cointegration

Conintegration turns the problem on its head. Rather than asking whether or not two pairs move in the same direction, it asks how likely are they to remain a certain distance apart. Naturally, that distance tends to vary with time. What you want the cointegration formula to tell you is how likely two pairs are to come back to a standard distance. If you see two pairs spread unusually far apart and the numbers tell you that they usually come back together, then it makes sense to consider a pair trade.

Ernest Chan has a friendly introduction to cointegration that I highly recommend. A much uglier, math intensive introduction to the subject, albeit one that is also far more thorough, is in the book Pairs Trading by Ganapathy Vidyamurthy.

Filed Under: How does the forex market work?, Uncategorized Tagged With: cointegration, correlation, forex

FREE trading strategies by email

Trending

Sorry. No data so far.

Archives

  • Dominari
  • How does the forex market work?
  • Indicators
  • MetaTrader Tips
  • MQL (for nerds)
  • NinjaTrader Tips
  • Pilum
  • QB Pro
  • Stop losing money
  • Test your concepts historically
  • Trading strategy ideas
  • Uncategorized
  • What's happening in the current markets?

Translation


Free Trading Strategies

Privacy PolicyRisk Disclosure

Copyright © 2023 OneStepRemoved.com, Inc. All Rights Reserved.