# Pairs trading with gold mining stocks

# Using a simple pairs trading strategy to trade gold stocks & ETFs

## Introduction

Welcome to the world of pairs trading, a different quantitative approach to the usual trading strategies, while most of them relies on trends and volatility, pairs trading only relies on highly correlated assets, doesn’t matter if the market is going up or down.

The logic behind this trading strategy is very simple, we pick two highly correlated assets and we make a spread when we trade the deviations of a time series involving the return of two assets.

This means, if Asset A performs higher than Asset B, we are going to short sell Asset A and buy Asset B with the intention that Asset A will under-perform Asset B, and since we don’t know if Asset A is going to go down, or if asset B is going to go up, we trade both.

Instead of trying to make a prediction of the markets’ trend, we use two different information sources.

We can complicate this however we want, we can use cointegration instead of correlation, for example, but i want to keep this article simple.

In order to do that, we are going to trade two highly correlated ETFs since they belong to the same sector, i’m talking about two gold mining assets.

GDX and GDXJ – Senior Gold Mining stocks and Junior Gold mining stocks.

## Understanding pairs trading

### Selecting our assets / stocks / etfs

We already know the basics, and as you can see, the theory is simple.

First of all, we need to find some correlated assets, forget about python or any programming language, i’m going to use a website for checking correlations.

ETF correlation tool – etfscreen.com

As we can see, GDX and GDXJ are highly correlated while neither of those have a significant correlation with their underlying asset, Gold.

Once we have our assets, which can be others of course. We are going to work preparing the data.

### Data integration (Order of integration)

When we use a price chart, or only the last change of the price, we are missing a lot of information, for starters, any asset has a different price.

This is why we integrate time series using percent returns. (See more)

I’m going to use only the electronic session, so, it will be something like this.

Integrated time series: Close / Open.

This way we have a more “universal” chart, where we can see each day’s percent return, and now we can make a spread using data integration. So we can compare the difference of returns detemined by the order of integration, in this case the order will be 1.

GDX = GDX_CLOSE / GDX_OPEN;

GDXJ = GDXJ_CLOSE / GDXJ_OPEN;

Spread = GDX – GDXJ;

As i said, there are a lot of ways to create pairs trading strategies, this one is probably the simplest way to create a decent strategy.

Now our spread will look something like this:

### Trading the Gold Mining stocks spread

Now that we have our spread, we can create our pairs trading strategy, this part tends to be complicated, because we can do a lot of variations to our strategy.

We can trade entry on our spread when it reaches a fixed trigger based on a predetermined parameter, and we can set it using an optimization process, or we can calculate the mean and standard deviations. And for the exit we can set a lot of different rules too.

For this example i’m going to keep this simple. Our two gold stocks (ETFs):

If our spread is greater than 0.01 i’ll short sell GDX and Buy GDXJ for a day, if it is lower than -0.01 i will buy GDX and short sell GDXJ for a day.

The result will be something like this:

As we can see, the result is decent but not great. Anyway, still better than 99% of technical analysis.

We can optimize the rules to have better results, in this cases the rules i set are arbitrary and almost random in order to make this example.

## Researching spreads:

The key in this strategy is correlation, in order to find an interesting correlation, we can use ETFs (Exchange Traded Funds) or Stocks, the main advantage with ETFs is the limitation of certain risks when we are trading the same or similar sectors.

While trading stocks we stand more risks (and we collect a higher premium).

For checking stocks correlations we have an interesting website: unicornbay.com

And the result will look something like this:

As we can see, both return and drawdown increases.

When we are preparing spreads, in order to do pairs trading, we need to keep in mind that this concept is quite large and it has a lot of ways of studying it.

It can be used with different assets, as we saw with ETFs and Stocks, we can try this with Forex and Futures too. Even with different futures expiration contracts so we can make a strategy based on:

Lean Hogs’ Current contract – Lean Hogs’ Next contract;

Back in the day i’ve learned this watching the Martin Shkreli’s investing lessons, in one video he started talking about quantitative analysis and why technical analysis is a waste of time.

Besides that, you can find on the internet some specific resources about pairs trading and quantitative finance, something that i talked in this article.

Algorithmic Trading Research – Follow the Edge.

As always, hope this can help you.

Víctor – Follow the Edge

## 1 Response