## 7.1 – Quick Reminder

We closed the previous chapter with a note on Density curve and how the value of the density curve helps us spot pair trading opportunity. In this chapter, we will work towards identifying and initiating an actual trade and learning other dynamics associated with a pair trade.

Just as a reminder – the techniques we have discussed so far in pair trading (i.e from chapter 1 through 7) is from the book called ‘Trading Pair’, by Mark Whistler. The good part about this technique is the simplicity and the part that I’m not too conformable with this technique is also its simplicity. Over time I’ve improved technique to pair trade, which I will discuss from the next chapter onwards.

Why not discuss the 2^{nd} method directly, you may ask – well, this is because I think Mark Whistler method to pair trade lays an excellent foundation and it helps understand the slightly more complex pair trading technique better. So let me attempt to finish the Mark Whistler’s method in this chapter and move to the next method to pair trade.

Now, because I’ll discuss this other technique to pair trade, I’ll take the liberty to not really get into the nuances of the trade set up. I’ll instead focus on the broad trade set up.

So let’s get started on it.

## 7.2 – Digging into Density curve

The density curve acts as a key trigger for us to identify an opportunity to trade. I want you to pay attention to the following two things –

- The density curve is calculated based on the time series data, and the time series data in our context is the ‘ratio’ – as you may recall from the previous chapter, the main inputs to calculate the density curve is the ratio’s time series, the ratio’s mean, and the ratio’s standard deviation
- The density curve is a value – varying between 1 and 0. The value of the density curve helps us understand the probability of the ratio, falling back to the mean.

I understand the 2^{nd} statement may confuse some of the readers, but at this point, I’d suggest you keep this statement in mind. You will understand what I mean by this as we proceed.

Let us spend a little time on the normal distribution, I know we have discussed this multiple times in the past, but bear with me one more time.

The time series data (like the ratio) typically have an average (or mean) value. For example, the average value for the ratio time series is 1.87 (we calculated this in the earlier chapter). More often than not, the value of the ratio tends to lie around the mean value. If the value of the ratio drifts away from the mean, then one can expect the value of the ratio to gravitate back to the mean.

For example, if the latest value of the ratio shoots up to 2.5, then over time, one can expect the value of the ratio to fall to 1.87 and likewise if the value of the ratio plummets.

Now here is a question – If the ratio drifts away from the mean (which is bound to happen on a daily basis), is there a way wherein we can quantify the probability of the ratio to move back to the mean, again?

For example, if the latest ratio value is at 2.5, we all know it will fall to a mean of 1.87, but what is the probability of this occurring? Is it 10%, 20% or 90%?

This is where the density curve comes in handy. The value of the density curve tells us how far, in terms of standard deviation, the ratio has deviated away from its mean. Now, if the value is in terms of standard deviation, then naturally there is a probability assigned to it, and eventually, this probability helps us set up a trade.

Let me give you a quick example.

Consider the following data –

Latest ratio – 2.87

Ratio Mean – 1.87

Density curve – 0.92

Here is how you will interpret this data – the 0.92 value of the density curve indicates that the latest ratio of 2.87 has approximately deviated to the 2^{nd} standard deviation and there is approximately 95% chance that the ratio of 2.87 will fall back to its average value of 1.87.

How did we arrive at this? I mean what tells us that the ratio of 2.87 is approximately near the 2^{nd} standard deviation? Well, we infer this by looking at the corresponding density curve value i.e. 0.92.

The density curve value from 0 to 1 represents the standard deviation values. For example –

- The density curve of 0.16 implies that the corresponding value is at the -1 standard deviation below the mean
- The density curve value of 0.84 implies that the corresponding value is at the +1 standard deviation above the mean
- The density curve value of 0.997 implies that the corresponding value is at the 3 standard deviations above the mean

Once I know the standard deviation, I’ll also know the probability.

But How did I arrive at 0.16, 0.84, 0.997 etc in the first place? Well, these are standard deviation values, I will skip dwelling further into standard deviation, instead give you a table which you can use as a ready reckoner –

Density Curve value |
How many Standard deviation away |
Probability of reverting to mean |
---|---|---|

0.16 | – 1 SD | 65% |

0.025 | – 2 SD | 95% |

0.003 | – 3 SD | 99.7% |

0.84 | + 1 SD | 65% |

0.974 | + 2 SD | 95% |

0.997 | + 3 SD | 99.7% |

Given the above, if I see the density curve value of around 0.19, I know the ratio is around the – 1^{st} standard deviation, hence the probability of the ratio to move back to mean is around 65%. Or if the density curve value is around 0.999, I know the value is around the – 3SD, hence the probability of the ratio to move back to mean is around 99.7%

So on and so forth.

## 7.3 – The first pair trade

So, finally, here we are, very close to showcasing our first Pair trade. Few points to remember –

- The ratio is calculated by dividing Stock A over Stock B. In our example, Stock A is Axis Bank and Stock B is ICICI Bank. So Ratio = Axis Bank / ICICI Bank
- The ratio value changes daily, based on the stock prices of Axis Bank and ICICI Bank
- The ratio and its corresponding density curve value has to be calculated daily

The trading philosophy is as below –

- If two business are alike and operate in the same landscape – like Axis Bank and ICICI Bank, then their stock prices tend to move together
- Any change in the business landscape will affect the stock prices of both the companies
- A stray incident can cause the stock price of one company to deviate away from the stock price of the other. On such days, the ratio to deviates
- We look for such deviations to identify good trading opportunities

So essentially, a pair trader tracks the ratio and its corresponding density curve value. A pair trade is set up when the ratio (and the density curve) has deviated convincingly enough from the mean value.

This leads us to the next obvious question – what is convincingly enough? Or in other words, at what value of the density curve, should we initiate the trade?

Here is a general guideline to set up a pair trade –

Trade Type |
Trigger (density curve) |
Standard Deviation |
Target |
Stoploss |
---|---|---|---|---|

Long | Between 0.025 & 0.003 | Between 2^{nd} & 3rd |
0.25 or lower | 0.003 or higher |

Short | Between 0.975& 0.997 | Between 2^{nd} & 3^{rd} |
0.975 or lower | 0.997 or higher |

The idea is to initiate a trade (either long or short) when the ratio is between 2^{nd} and 3^{rd} standard deviation and square off the position as it goes below the 2^{nd} standard deviation. Obviously, the closer it goes toward the mean, the higher is your profit.

Lets set up a trade based on the above table, for this, I’d suggest you **download** the excel sheet available towards the end of the previous chapter.

On 25^{th} Oct 2017, the density curve value was 0.05234 and the corresponding ratio value was 1.54. This is a decent **long pair** trade set up. Although this does not fall within the preview of a long trade (we need the density curve to be between 0.025 and 0.003), I guess this is the best value in the time series we are considering.

If the ratio is defined as Stock A / Stock B, then –

- A long trade requires you to buy Stock A and Sell Stock B
- A short trade requires you to sell Stock A and Buy Stock B

We have defined the ratio as Axis / ICIC, hence, on 25^{th} closing, one would –

- Buy Axis Bank @ Rs.473
- Sell ICICI Bank @ 305.7

The lot size for Axis is 1200, hence the contract value is 1200 * 473 = Rs.567,600/-. The lot size of ICICI Bank is 2750, hence the contract value is Rs.840,675/-.

Ideally, we need to stay long and short of the same Rupee value. This is also called ‘Rupee Neutrality’, but I’ll skip this part for now. We will take the concept of Rupee neutrality to a different dimension when we take up the next pair trading technique.

So, once the trade is set up, we now have to wait for the pair to move towards the mean. Ideally, the best pair trade is when you initiate a trade near the 3^{rd} SD and wait for the ratio to move to the mean, but then this could happen over a long period, and the mark to market could be quite painful. In the absence of deep pockets to accommodate for mark to market, one has to be quick in closing a pair trade.

On 31st Oct 2017, the ratio moved up to 1.743 and the corresponding density curve value was 0.26103, which is roughly the target density curve value. Hence once can consider closing the trade.

We Sell Axis Bank @ 523 and buy back ICIC at 300.1. The P&L and other details are as follows –

Date |
Stock |
Trade |
Lot Size |
Sq off date |
Sq off Price |
P&L |
---|---|---|---|---|---|---|

25^{th} Oct |
Axis Bank | Buy @ 473 | 1200 | 31^{st} Oct |
Sell @ 523 | 50*1200 = 60K |

25^{th} Oct |
ICICI Bank | Sell @ 305.7 | 2750 | 31^{st} Oct |
Buy @300.1 | 5.6*2750 =15.4K |

Total P&L |
Rs.75,400/- |

If you notice, the bulk of the profits comes from Axis Bank, this indicates that Axis Bank had deviated away from the regular trading pattern.

Not bad eh?

Let’s look at a short trade now.

On 9^{th} August 2016, the density curve printed a value of 0.99063156, close enough to initiate a short pair trade. Remember in a short trade, we sell Axis and buy ICICI.

If you find it confusing to remember which one to buy and sell, think of it this way – the numerator is the dominating stock, so if the pair trade demands you to go long, then buy the numerator. Likewise, if the pair trade is to short, the short the numerator. Whatever you do with the numerator, the opposite trade happens with the denominator.

Hence we sell Axis Bank (numerator) and sell ICICI Bank (denominator).

Trade details are as follows –

- Short Axis @ 574.1
- Buy ICICI @ 245.35
- Ratio – 2.34
- Corresponding Density Curve value – 0.99063156

Once initiated, the opportunity close this trade occurred on 8^{th} Sept, (yes, the trade was held open for almost a month). The trade details were –

- Buy Axis @ 571
- Sell ICICI @ 276.33
- Ratio – 2.27
- Corresponding Density Curve value – 0.979182

Agreed, once could have waited a bit longer to for the density curve to fall further, but then like I said before, the pair trader has to strike a balance between the time and mark to markets.

The P&L for the trade is as below –

Date |
Stock |
Trade |
Lot Size |
Sq off date |
Sq off Price |
P&L |
---|---|---|---|---|---|---|

9^{th} Aug |
Axis Bank | Sell @ 574.1 | 1200 | 8^{th} Sept |
Buy @ 571 | 3.1*1200 = 3.72K |

9^{th} Aug |
ICICI Bank | Buy @ 245.3 | 2750 | 8^{th} Sept |
Sell @276.33 | 31.03*2750 = 85.3K |

Total P&L |
Rs.89,052/- |

Again, the bulk of the profit comes from one of the stocks i.e ICICI, indicating that ICICI had probably deviated away from its course.

I must confess, both the trades did not really fall under the prescribed table giving you the guideline to enter and exit the pair trade. But like I said before, use the table as a reference and build your expertise around it.

I’d encourage you to look for any other opportunities in the Axis & ICICI Bank example.

I hope the P&L of pair trade is incentivizing you enough to learn more about pair trading. I’ll deliberately stop here, to ensure you soak in everything that we have discussed. I’ll leave you with few final points.

- Everything we have learned so far accounts to about 25% of what I intend to discuss going ahead
- These first 7 chapter discusses a very basic pair trading technique, mainly to help lay a foundation
- We have not adhered to strict trade definitions – stop loss, targets etc. If you notice, I’ve kept things quite generic
- Neutrality of both the positions is a key angle, we have not discussed that yet
- We are yet to discuss the risk associated with Pair trading
- Pair trading is a margin money guzzler, so one needs to have sufficient funds to pair trade, but the P&L is worth it
- For a given pair, at the most 2-3 signals is what you can expect in a year. So one has to track multiple pairs to find continuous opportunities in the market

Anyway, I hope I’ve managed to ignite your curiosity to learn more on Pair Trading. I’m eager to move forward, I hope you are too!

**Download** the excel sheet.

### Key takeaways from this chapter

- The density curve acts as a key trigger to initiate a pair trade
- A pair trade is initiated when the ratio drifts to a value between 2 and 3 standard deviation
- A pair trade is closed when the ratio approaches the mean
- Long pair trade requires you to buy the numerator and sell the denominator
- Short pair trade requires you to sell the numerator and buy the denominator
- Typically, the bulk of P&L comes from one of the stocks which have deviated away from the regular pair trade
- Pair trade can be live for an extended period, but the P&L makes the wait worth it
- Pair trade is a margin money guzzler.

Sir about the instrument, when you say buy axis bank or icici, are you referring to the stock or its Futures?

Yes, it is the futures.

PAIR trading can only be done in Futures.

It can be done with a combination of futures and spot as well. Will discuss more on this in the following chapters.

sir i have done tata motor vs tata dvr through method 1. i got density curve 0.65 to 0.67 so when to take position

When the density curve hits 0.997, I have explained this in the chapter.

Is it necessary that it will hit 0.997 ?

It is all about the degree of conviction you’d need 🙂

Hello Karthik…!!

If i first find correlation between the stocks, then Ratio of the two stocks, Then Average of the Ratio. Than from the Average of the Ratio if i calculate SD1 & 2 (+-) will it work or not….??

Yes, in fact, the excel sheet has these calculations.

One can use http://www.screener.in to find out about companies with similar business.

Sir can we use pair trading between crude oil and brent oil??

You certainly can.

When is the next part of the relative value trading coming out?

Starting next week, hopefully.

Hi

Thank you for your reply, looking forward to the remaining part of the lesson.

As a request, I would love to get some information on the backtesting part for the pairs trading model. I can help you with any programming help if needed related to that.

And a big thank you for sharing knowledge 🙂

Arpan, thanks. I will probably put up the guideline for programmers. I will do this for the 2nd part of pair trading. Maybe open this up for all, so that everybody can benefit.