Contents

Now before I explain cointegration, here is the sector wise distribution of FnO stocks along with number of stocks in each sector or industry. I will encourage you to quickly browse through it and try to spot some pairs from same sector and comparable market cap which you might prefer to trade. As noted, the correlation between a pair of stocks is the key to pairs trading. Stocks pitbull trading book are perfectly correlated when they move in sync and inversely correlated when they move in opposite directions but still in sync (at a coefficient of -1). If stocks do not have any correlation between them, their coefficient is 0. A pairs traders buys one stock and shorts the other, creating a neutral position overall if correlation remains the same as it has done historically.

- After locating, right-click on either working order and select View Complex Order.
- To avoid this, pick a small number of pairs you have reason to suspect might be cointegrated and test each individually.
- He has authored books on technical analysis and foreign exchange trading published by John Wiley and Sons and served as a guest expert on CNBC, BloombergTV, Forbes, and Reuters among other financial media.
- Chart 4 plots the trend of Adf Test Stats along with the critical value of the pair of interest.

How large or small depends on your risk appetite, however the absolute best is the point of minimum and maximum divergence – the highest and the lowest point on blue line in Chart 2. So look for stock pairs for which current deviation is near historical max or min deviation values. Once more, we plot a few of the time series data points of stocks within the same cluster for confidence. From a visual perspective, stocks within the same cluster do show a realtively high correlation among them in terms of the behavior of the stock prices. In order to increase confidence in the clustering procedure, the real time series stock price data of the stocks in each cluster were also investigated. The time series data of the stocks in 4 of the 31 clusters are illustrated below.

## Essential terms used in pairs trading

Investors piled into GameStop and AMC stock in an attempt to trigger a short squeeze. A long-short pair trade emerged based on the fundamentals and capital needs of the companies. Futures accounts are not protected by the Securities Investor Protection Corporation . All customer futures accounts’ positions and cash balances are segregated by Apex Clearing Corporation. Futures and futures options trading is speculative and is not suitable for all investors.

First let’s check the correlation of the series we just generated. You won’t get your trading signals from the charts of the individual stocks themselves, instead, you need to create a ratio chart. An example of a famous failed pair trade is Julian Robertson’s short NASDAQ tech stocks, long value stocks during the dotcom bubble. The primary two methods of identifying how stocks relate are correlation and cointegration.

So while you can’t have some of the special sauce the quant funds use with their fancy models, you can get 80% there with some very simple technical trading tools like Bollinger Bands or RSI. For a strategy so rooted in math, you’d be pretty surprised how simple some strategies can be. When it comes to qualitative pairs trading, you could have any number of reasons for putting on a trade.

Pairs trading was first introduced in the mid-1980s by a group of technical analyst researchers that were employed by Morgan Stanley, the multinational investment bank and financial services company. The pairs trade strategy uses statistical and technical analysis to seek out potential market-neutral profits. Pairs trading is a strategy that tends to use statistics to identify relationships, assist in determining the direction of the relationship, and then ascertain how to execute a trade based on the data. The pairs trader attempts to capitalize on market imbalances between 2 or more financial instruments, such as stocks or funds, in anticipation of making money when the inequality is corrected.

In early 2021, the “reflation” trade was all the rage, which is a bet that assets that benefit from inflation like commodities will outperform those assets that suffer from inflation, like bonds. If Coca-Cola stock goes up a lot while Pepsi remains unchanged, you would short Coke and buy Pepsi. The theory goes that Coke and Pepsi’s business are nearly identical–they’re both mature companies operating in the same industry. Since this is discrete data, squaring off of the position happens at the end of the candle i.e. at the price available at the end of 5 minutes. There can be many ways of defining take profits depending on your risk appetite and backtesting results. Stop loss is defined for scenarios when the expected outcome does not occur.

It can also be referred to as market neutral or statistical arbitrage. We also used Kalman filter as an online linear regression method. The idea is to assume linear relationship between the prices of the related assets.

## Get the Stock Prices

For example, stocks don’t always return to their correlated relationships after a divergence. Hence, please do not be under the impression that pair trading in market neutral. This is a trading strategy that seeks to take advantage of price differentials between two, related assets. To simplify the backtesting, we just set the initial money as million dollars and the volume of the stocks we trading as ‘total assets’ / ‘# of pairs’. Therefore, if our current total asset is $100 and the number of stock pairs is 10, we long/short the stock only with $10.

In trading, tomorrow always comes, only most of the time you are not there to welcome it ;-). Pair trading is a powerful trading strategy based on the assumption that highly correlated pairs of stocks or other financial instruments will return to their previous correlation after any divergences. The strategy can be employed over both intra-day and long-term timescales, although correlations may be more or less powerful over different timescales. Today, pairs trading is often conducted using algorithmic trading strategies on an execution management system. These strategies are typically built around models that define the spread based on historical data mining and analysis. The algorithm monitors for deviations in price, automatically buying and selling to capitalize on market inefficiencies.

Pairs trades can be complex, and it’s important to monitor your risk closely. What if the Technology sector continues to outperform the broader market? Or what if the pair’s divergence from its normal correlation lasts longer than you expected? Even a difference of a few cents in the purchase or sale price of the stocks in the pair trade can be significant because of the high volume of these trades. Furthermore, this risk is amplified by the fact that four orders, rather than two, need to be placed and filled at the expected price in order for the pair trade to be profitable. Arguably the most arduous and critical step within the pairs trading strategy is the process of choosing the pair to trade.

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. An increasing share count is not generally supportive of the equity price of a company, as the market has a new supply of stock to bring down prices. This could explain the relative outperformance of GME to date. I suspect this will continue, but a bankruptcy, restructuring, or massive dilution could serve as a catalyst to bring AMC shares lower. GameStop and AMC stock have become highly correlated, often trading lockstep despite their distinct risk profiles, which presents a compelling opportunity to buy GME and sell AMC.

## Warrior Trading Blog

Because GameStop and AMC stock became highly correlated, a high-alpha pair trade with low potential volatility has emerged. The Secret Sauce – The best profitable pair trade opportunity arises where the Current Deviation From Mean is either near Maximum Deviation From Mean or Minimum Deviation From Mean. In other words, Current Deviation From Mean should be significantly larger or smaller than the Standard Deviation.

Using a large set of data from 1967 to 1997, the trio found that over any six-month trading period, the pairs trade averaged a +12% return. Market-neutral strategies are a key aspect of a pairs trade transaction. Market-neutral strategies involve long and short positions in two different securities with a positive correlation. The two offsetting positions form the basis for a hedging strategy that seeks to benefit from either a positive or negative trend.

Macro traders might bet that the S&P 500 will outperform the NASDAQ 100, or that value stocks will outperform growth stocks. It is defined as scenarios where you take profit before the prices move in the other direction. For instance, virtual reality stocks say you are LONG on the spread, that is, you have bought stock A and sold stock B as per the definition of spread in the article. Calculate z-score of ‘s’, using rolling mean and standard deviation for a time period of ‘t’ intervals.

A Bollinger Bands strategy simply waits for the pair to reach one side of the band. When the ratio reaches the lower band, it creates a signal to buy the first symbol , and short the second symbol . The models aim to buy or sell the pair when it diverges from the mean, and close the trade when it reverts back to the mean.

Chief among the drawbacks is that it’s a mean reversion strategy, meaning that your average winning trade is small and your average losing trade is comparatively large. It’s pretty tough psychologically too, because the more the trade goes against you, the more sense it makes to average down. Unless there’s a very compelling reason, the performance of the two stocks should be similar.

Of assessing correlation is to identify a reason for the correlation. Two stocks that are completely unrelated may be correlated, but if there is no explanation why that correlation could be random. So, most traders turn to stocks that have some relationship between them when looking for correlation. That may be two direct competitors or two stocks in the same industry. Once the trader finds two securities to trade, it is often then wise to test the pair with a short-term trade before committing to something longer. The correlation between the pair, which will be a value between -1 and 1, must be established, so the trader will understand how closely related the pair is to one another.

Pepsi and Coke are known as a “pair” in the pairs trading world. Pairs trading involves making two bets on different, but related securities. Most of the time, you buy one security and short another security. With pairs trading, you’re combining two separate bets into one. Having already established that the equation above is mean reverting, we now need to identify the extreme points or threshold levels that when crossed by this signal, trigger trading orders for pairs trading. Given a normal distribution of raw data points, the z-score is calculated so that the new distribution is a normal distribution with a mean of 0 and a standard deviation of 1.

## Step 2: Chart the 2 assets

Pairs Trading can be called a mean reversion strategy where we bet that the prices will revert to their historical trends. As mentioned, if you are running a pair trading strategy on stocks, you probably need to run the strategy on more than a single pair of stocks. Traders can use either fundamental or technical data to construct a pairs-trading style. Our example here is technical in nature, but some traders use a P/E ratio or other fundamental factors to measure correlation and divergence. In order to short sell at Fidelity, you must have a margin account.

The pairs trading strategy uses statistical and technical analysis to seek out potential market-neutral profits. A pairs trade in the futures market might involve an arbitrage between the futures contract and the cash position of a given index. When the futures contract gets ahead of the cash position, a trader might try to profit by shorting the future and going long in the index tracking stock, expecting them to come together at some point.

Execute the trade– Once you have spotted a significant short term deviation from mean price differential, you have toSell high priced stock and Buy low priced stock. Now to cross verify the validity of cointegrated pairs, I will encourage you to click on the table rows. It will load few charts and tables which will help in validating what we have inferred pitch the perfect investment just now. If you are doing it for the first time then click on the first row of the table as in this case the difference will be more forthright. Only the short stock moves as projected, but is more profitable than the long-traded offset. We performed such test to all pairs and select at least one pair in each cluster to diversity our portfolio.