Last Updated on October 16, 2020
What is pairs trading? Pairs trading is a trading strategy that involves buying one asset and shorting another.
The aim of pairs trading is to bet that, if the prices of 2 assets diverge, they will converge eventually.
To short something is to bet that it falls.
Table of Contents
- Does Pairs Trading Work?
- How to (Visually) Test a Pairs Trading Strategy?
- How to Find a Pair of Assets for Pairs Trading that Works?
- How to Design a Pairs Trading Strategy for the Real-World?
- How Not to Design a Pairs Trading Strategy?
- Benefits of Pairs vs Outright Trading?
Does Pairs Trading Work?
Half-yes. It depends on the assets that you choose and how you execute the trades.
Pairs trading is an old strategy. You need to add your own flavor (additional analysis) to it or use more than 2 assets if you want it to work.
How to (Visually) Test a Pairs Trading Strategy?
Visual testing is one of the fastest and most efficient way to get started with pairs trading.
We scan the charts of 2 assets to see if they diverge and converge. This is called a visual test.
If you find potential in your visual test, you can then move on to testing the strategy using code.
- Choose 2 assets
- Chart the 2 assets
- Visually backtest your assets
Step 1: Choose 2 assets
Let’s look at a pairs trading involving these 2 assets:
- FTSE 100 Index Futures (aka Z)
- iShares MSCI United Kingdom Index (aka EWU)
Z is an asset that tracks a group of popular UK stocks.
EWU is an asset that also tracks similar stocks.
You can read more about Z and EWU in the appendix.
Step 2: Chart the 2 assets
We will use TradingView for this.
Step A: Open TradingView.com. Search for our first asset, Z.
In the drop down list, expand the line on FTSE 100 Index Futures.
What is Z1!?
Futures are different from stocks in a way that they expire, usually every quarter. This makes it difficult for us to chart prices over years.
Fortunately for us, Z1! exists. Think of Z1! as a stitched together chart of all the most actively traded contracts.
More info on what futures are: https://algotrading101.com/wiki/futures-finance/
Step B: Choose “Full-featured chart”.
This will open up the FTSE 100 Index Futures chart.
It should look something like the chart below.
Step C: Add EWU.
Click on the plus sign at the top of the page.
Type EWU in the pop up box.
Choose “EWU ISHARES TRUST MSCI UTD KINDGOM ETF NEW”
You should see something like the chart below.
Things are looking better!
You have now overlaid the chart of Z (blue) on the chart of EWU (red).
Step D: Clean up the chart.
Let’s clean up our chart.
Remove the volume bars. Click on the cross on the “Vol” symbol.
Convert the blue area chart to a line.
Click on the area symbol at the top. Click on “Line”.
You should see something like this now:
Understanding how TradingView overlaid charts work
The way TradingView charts 2 overlaid assets is by percentage change.
The chart will equalise the left most point visually. Then the number on the y-axis is the change in price since the left most point.
Using the above chart as reference, we see that the blue and red lines have the same starting point on 28th Dec 2016.
Z (blue line) moved up by 2.41% between 28th Dec 2016 to early March 2017.
EWU (red line) moved up by 15.5% between 28th Dec 2016 to early March 2017.
Step 3: Visually backtest your assets
Step A: Scroll back. Zoom in.
Let’s arbitrarily start from the beginning of 2019.
Scroll your chart back to 1st Jan 2019.
Zoom in such that the length of the chart is about 2 months. Zooming in allows us to analyse the chart in more detail.
Step B: Look for price divergences
This is where the real testing starts.
Visually scan for divergences.
In this case, I see a small divergence (green line).
Let’s hypothetically enter a trade on 28th Jan 2019. We buy $100 worth of Z (blue line) and short $100 worth of EWU (red line).
Let’s call this Trade A.
I drew a green line to make things clearer to follow but you don’t have to.
Step C: Shift the trade starting point to the left.
We shift it to the left to see how Z and EWU perform from 28th Jan 2019 onwards.
Step D: Look for a convergence to exit the trade
Recall that we had long the blue line and short the red line on 28th Jan 2019.
Now, we are looking to close the trade.
We are looking for the prices to converge so that we can take a profit, or we are looking for further price divergences so that we will take a loss on the trade.
In this case, the prices converged since the blue line went up more than the red line.
We spotted a convergence on 13th Feb 2019. Thus, we closed our trade.
From 28th Jan to 13th Feb 2019, Z (blue) went up by 6.56% and EWU (red) went up by 3.62%.
We bought $100 worth of blue. That is now $106.56; a $6.56 profit.
We shorted $100 worth of red. That is now $96.38; a $3.62 loss.
In total, we made $6.56 – $3.62 = $2.94 from an initial investment of $200.
2.94 divided by 200 = 1.47.
This is a 1.47% return for this trade!
Step E: Repeat steps B to D!
Keep doing this and record the profits and losses of your hypothetical trades.
Step F: Decide if you want to move on to actual backtesting with code.
If you see that divergences and convergences keep occurring, your strategy might have potential. If so, you can then consider moving on to actual backtesting with code.
We will talk about backtesting the pairs trading strategy, using 1) simple statistics and 2) a backtesting code library or software, in another article!
Some notes on visual testing
Check for data cleanliness
Some products do not have overlapping trading times.
If Asset A trades from 1am to 9am and Asset B trades from 12pm to 8pm, it will be difficult (not impossible) to execute a pairs trade.
If you use the end-of-day data, you might not be able to enter at the listed prices. Or, the end-of-day timings might be different for the 2 assets.
In other cases, there might be missing or wrong data.
Usually, we check for data cleanliness at the backtesting with code stage. We look for potential errors and try to get data from multiple sources to compare.
In our case, the closing time for Z and EWU are different.
Thus, we use the charts for preliminary analysis but can’t rely on it for live trading.
We need to get more accurate data and run backtests using those data. I trade with Interactive Brokers and I prefer to download data directly from Interactive Brokers for my analysis.
Avoid look ahead bias
This means that before you enter your hypothetical trade, don’t look at any potential exits.
If you look ahead in the graph to spot a profitable exit, and only decide to enter your trade because of that, your trades are biased.
That will be cheating as you are looking into the future!
Find average divergences and convergences
After a few trades, you can have a feel for the average divergences and convergences, i.e. deviations.
If you notice that the deviations are say, 3%, then you can use maybe 5% as your entry and exit points.
If the market condition changed and the average deviation is 10%, then a deviation of say 15% is appropriate as your entry and exit points.
The general idea here is that you want to enter and exit the trades when the deviations are slightly higher than the recent average.
How to Find a Pair of Assets for Pairs Trading that Works?
There are 2 ways: 1) top-down and 2) bottom-up.
Top-down (Market prudence)
The top-down method is what we call market prudence.
In this case, we start with a hypothesis based on logical economic reasoning.
E.g. Futures and ETFs of the same products should behave similarly. The 10-year US bond might move similarly to the 10-year Canadian bond if both countries’ central banks are expected to behave similarly.
The bottom-up method entails collecting all the data under the sun and checking which 2 (or more) assets behave similarly.
We then retrospectively look for plausible reasons for the similar movement, or we might dismiss it as coincidence.
As retail traders, we usually go for the top-down approach.
If you are a $10 billion quant hedge fund, then yes, you have the resources to collect plenty of data.
How to Design a Pairs Trading Strategy for the Real-World?
Choose non-stock assets
Look for ETFs, futures, non-stock assets and other derivatives.
I do believe that in general, it is easier to find non-stock assets that move similarly.
Example: US bonds vs German bonds. Large cap ETFs vs small cap ETFs. Futures vs ETFs.
Choose 2 assets that are very similar
As mentioned, this is easier for futures and ETFs etc. Stocks are difficult.
It is harder to pairs trading 2 stocks if you are purely doing it quantitatively.
This is because it is hard to find 2 stocks that are very similar.
And no, 2 stocks from the same sector is not good enough.
However, if you choose to trade 2 stocks, consider doing it over a limited time period (e.g. during the COVID-19 crisis, cruise stocks move together) or use another qualitative layer of analysis.
Decent examples: Uber vs Lyft. Carnival vs Royal Caribbean Cruises.
Use your domain expertise
Even if you choose 2 decent assets, it is unlikely that you will make money if you blindly trade every divergence.
Thousands of hedge funds are scouring the face of the earth to find pairs that work. Any pair that you find have probably been watched like a hawk.
However, if you understand the assets well, you can choose and time your trades better than others.
You will know when to enter the trade and when not to, even as the 2 assets diverge and everyone else is entering the pairs trade.
Example: Longing near term lean hog futures and shorting the further expiry during the peak of Swine flu. You do this against the crowd as you are a virus expert and know if the crisis has been overblown. (Note: This is a hypothetical example. I have no idea how lean hog futures traded during the Swine Flu crisis).
Use another layer of analysis
Instead of just looking at 2 assets, look at what leads those assets.
A leading asset is something that moves before your asset moves.
If you are trading a US stock ETF vs a European stock ETF, find something that leads these ETFs.
Maybe you can use the US 2-10 bond spread to lead the US stock ETF and a German 2-10 bond spread to lead the European stock ETF.
Another example is that your pairs trade might only work during volatile periods. In this case, you might only want to execute it during the periods that work.
Limit your trades to certain time periods
Certain assets diverge during certain hours and converge during other hours.
Maybe some of them don’t move as expected on Mondays, December or some other time-based conditions.
Example: Assets behave differently near a big macro-economic or earnings announcements.
Another example is that certain assets diverge or converge during crisis times. You might be able to find opportunities that only exist during this period.
Adjust the weights
Your trades don’t have to be $1 of Asset X vs $1 of Asset Y.
If Asset X is twice as volatile as Asset Y, you can trade 2 units to 1 unit.
Example: Carnival cruises have a beta of 1.97. Royal Caribbean cruises have a beta of 2.52 (based on investing.com as of 22th June 2020). Thus, you might want to enter 4 shares of Carnival for every 5 shares of Royal Caribbean in order to hedge against market movements.
Entering an equal dollar amount for both assets usually doesn’t work, especially if the 2 assets are very different.
For instance, a stock might move 1% a day on average, while a cryptocurrency coin moves 5% a day on average. Buying and shorting $1,000 on each will bias the impact of your pairs trade towards the cryptocurrency.
You need to buy 5 times more stock than the crypto coin.
For futures, the dollar value per unit of movement is usually different for different future contracts.
Moreover, the average price movement of the different future contracts are different too. Thus, we need to account for these to make sure the size our bets right.
Consider betting on divergence
Instead of entering a trade on divergence and betting on convergence, you can enter a trade on divergence and bet that there is even more divergence.
Is this case, you are betting that the 2 assets will become increasingly different from each other as time goes by.
No home runs needed
You don’t need your pairs trade to return huge profits per trade. A slight edge would be sufficient.
If you make 0.5% per trade (net of fees) and manage to fire 5 trades a month, you will make 2.5% a month.
Do size your bet appropriately. In general, the lower the expected return, the smaller your bets.
Trade many pairs
This reduces the reliance on a single pair.
Imagine if we identified and are trading 20 pairs independently. We would have allocated 5% of our capital per pair.
If a single pair breaks down, we still have 19 other pairs. Our portfolio will not be severely affected.
Another way to do this is to run a “pairs” trading strategy that consists of more than 2 assets per strategy.
Quantitative hedge funds do this and they might have thousands of stocks and make thousands of trades in their high-frequency strategy.
We won’t cover that in this article. This is an interesting read if you want to know more: Statistical Arbitrage
How Not to Design a Pairs Trading Strategy?
Choosing 2 assets, which are very different, that happen to move together for a short period and assuming that will continue.
This could be just a coincidence!
In statistics, it is known as a spurious correlation.
Benefits of Pairs vs Outright Trading?
An outright trade is a directional trade. This means that you long (or short) 1 asset in hopes that it goes up (or down).
Benefits of an outright trade:
- If you identified a good stock and just want to buy and hold, you will make more if you don’t hedge with a short.
Benefits of a pairs trade:
- If the trade goes against you, you can just hold and there is a high change it converges. In an outright trade, it can keep going against you until your pockets bleed out.
- It is easy to hedge unwanted risks and target specific risks. E.g. if you don’t want to be affected by market movement but you want to bet that Dropbox will outperform Box (another file sharing company), you can do a pairs trade.
- You can dangle a pairs trade. This mean that you can close one side of the pairs trade and let the other run. One way to do this is to keep both sides, wait till the market condition changes (e.g. a crisis hits and the market drops a lot), then close one side (in the crisis scenario, you will close your long and keep your short).
What is FTSE 100 Index Futures (Z)