Pairs Trading Strategy for Indian Stock Market

September 26th, 2011Comments closed

pairs-trading tutorial

We are pleased to announce that now you can analyse any pair of stocks using well-known pairs trading strategy at techpaisa. To the best of our knowledge, we are the first website in India to provide this utility online, and free of cost as of now.

What is pairs trading?

As the name suggests, pairs trading strategy works with a pair of stocks. First step is to find a pair of stocks or indices whose prices "move together". Moving together of price is technically known as cointegration. Idea is to find the pair of stocks which move together but occasionally, this pair will diverge from the average. Whenever a pair diverges from their mean, take positions in both the stocks (one long position and one short position). Gradually, when the prices of these stocks revert to the mean, exit the trades and book profit.

Pairs trading is a market-neutral strategy. A market-neutral strategy means that profit doesn't depend on the direction of market. As long as the prices of pair of stocks revert to mean, you make money.

How to choose pairs?

First step in pairs trading strategy involves choosing pairs. We suggest you choose stocks from the same sector or subsector. Other pair could be to take one index and choose one of the constituent stocks. Example pairs: SBIN-AXISBANK, AMBUJACEM-ACC. You can also consider two indices as a pair.

At techpaisa, you can do pairs trading here. When you have chosen a pair, use first stock as stock whose market capitalization is more than the second stock. We also give a confidence in statistics of finding pairs, always use pairs with atleast 60% confidence.

How to do pairs trading?

After you have chosen that a pair of stock prices move together, you have to wait for the prices to diverge from their mean. When the prices diverge from their mean, one stock become overvalued and the other undervalued. The bet is that undervalued stock will outperform the overvalued stock and prices will revert to mean. You take long positions in undervalued stock and short positions in overvalued stock. By doing this, your positions become market-neutral (at-least theoretically).

Question is at what divergence, you will take positions, we suggest waiting for a divergence of at least 2 standard deviations from the mean. You can devise your own strategy. We strongly recommend you keep a target and a stop loss for your positions. Keep your target to the point where divergence reverts to 0.5 of standard deviation from mean. Keep your stop loss if divergence becomes 2.5 or 3 times standard deviation from mean.

We backtest pairs trading strategy on historical data to find out optimal entry divergence and stop loss divergence. So for some pairs, you will find that entry divergence is different from +2 or -2.

Example

We will take nifty and banknifty as an example. With 90% confidence, nifty and banknifty prices move together. NIFTY is STOCK1 and BANKNIFTY is STOCK2. Sequence of stocks in a pair matters because based on divergence and sequence of stocks we will determine which stock to long and which stock to short.

In the chart below, prices of nifty and banknifty diverges at 2.01 (standardized error) times the standard deviation from mean. We take positions when standardized error is approaching 2 from above or -2 from below i.e. divergence is decreasing. In the figure below, divergence is approaching -2 from below which means STOCK2 (banknifty in this case) is undervalued (long banknifty) and STOCK1 (nifty) is overvalued.

Standardized Error - Deviation from mean as a multiple of standard deviation

In the chart below, we have the prices of nifty and banknifty.

Nifty and Banknifty price

We take positions on 7th January 2011. Since banknifty is undervalued and nifty is overvalued. We go Long BANKNIFTY and Short NIFTY. Quantities are also decided based on Cointegration Coefficient which we call slope on analysis page. Slope is 3, which means for every 100 stocks in banknifty, trade 300 stocks in nifty. In futures lots, that translates to 3 lots of nifty (150 stocks) and 2 lots of banknifty (50 stocks).

Lets say we buy at the closing price of 7th January 2011 which is Rs. 5904 for NIFTY and Rs. 11053 for BANKNIFTY. We see that prices revert to mean after 7th January 2011 and if we close at our target of 0.5 standard deviation from mean, then that is reached on 24th January 2011. Price on that day is Rs 5743 for NIFTY and Rs. 11151 for BANKNIFTY. Our profit is (5904-5743)150 + (11151-11053)50 which is Rs 29050.

As a general rule, if pair is STOCK1-STOCK2, and entry divergence is negative then LONG STOCK2 - SHORT STOCK1. If entry divergence is positive, LONG STOCK1 - SHORT STOCK2.

You can employ your own strategy for closing trades like you close positions when the standardized error becomes zero i.e. prices revert to the mean exactly.

Caveats

It may happen that pair of stocks you chose whose prices have diverged might not revert to mean because of a news flow or any other fundamental change in one of the stocks and the statistical relationship doesn't hold for this pair of stocks anymore.

More links

Techpaisa Team.

DISCLAIMER: If you trade stocks, you do so at your own risk. Trading/Investing in stocks carry high risk. Any trade or action you take in the market is your own responsibility. Techpaisa.com will not be liable for any loss arising out of the use of any information on the website by anybody.

Discussion

Comments for this post are closed.