# 14. Live Example – 2

## 14.1 – Position Sizing

I know, the discussion on pair trading was to end with the previous chapter, but I thought I had to discuss a special case before we finally wrap up. I’ll also try and keep this chapter really short ☺

So here you go.

I ran through the pair trading algo y’day evening (28th May) and found a very interesting trade. Here are the regression parameters –

• Stock X = ICICI Bank
• Stock Y = HDFC Bank
• ADF = 0.048
• Beta = 0.79
• Intercept = 1626
• Std_err = 2.67

What do you think of it? Perfect isn’t it? Its ICICI and HDFC, two of the largest private sector banks, both have similar business landscape, both have a similar revenue stream, both regulated by RBI. Perhaps the perfect candidate for a pair trade, right?.

The Adf value is 0.048, which means there is only 4.8% chance that the residual is non-stationary or about 95.2% chance of the residuals being stationary, which is fantastic.

The std_err is +2.67, which is a perfect residual value to initiate a short pair trade. The trade here is short HDFC and go long on ICIC.

So, how do we position size this? Here are the price and lot size details –

• HDFC Fut Price = 2024.8
• HDFC Lot size = 500
• ICICI Fut price = 298.8
• ICICI Lot size = 2750

Remember we discussed position size in the previous chapter. We look at the beta and estimate the number of shares required for this trade.

The beta is 0.79, this means, every 1 share of Y needs to be offset with 0.79 shares of X. The lot size of HDFC (Y) is 500, this means to offset the beta, we need 395 shares of ICICI (X).

Do you see the problem here? The lot sizes simply do not match.

We cannot simply trade 1 lot each here like we did in the TATA Motors and Tata Motors DVR example, discussed in the previous chapter. If we do, then this won’t be a beta neutral trade.

Hence to position size this, we need to work around with the lot sizes –

The lot size of ICIC is 2750, beta is 0.79, lot size of HDFC is 500. Given this, that the lot size is higher than HDFC, what should be the minimum number of HDFC shares which will beta neutral 2750 shares of ICICI.

To figure this out, we simply divide –

2750/0.79

= 3481.01

Since the lot size of HDFC is 500, we can round this off to 3500. Considering the lot size of HDFC is 500, this will be 7 lots of HDFC against 1 lot of ICICI.

## 14.2 – Intercept

Alright, now that we know the position size as well, here is the big question – will you take this trade?

Everything seems perfect, right? ADF has a desirable value, residual is at 2.67 SD, the two stocks are highly correlated, the business is similar. So what can go wrong?

Yes, I agree, everything looks good, but on a closer look, the intercept reveals a slightly different story.

To understand this, we need to quickly revisit the regression equation –

y = Beta * x + Intercept + Residual

If you think about this equation, we are trying to explain the stock price of Y in terms of the stock price of X multiplied by its beta. The intercept is essentially that portion of the y’s stock price which the model cannot explain, and the residual is the difference between predicted y and actual y.

Going by this, a large intercept implies that a large portion of Y’s stock price cannot be explained by the regression model.

In this case, the intercept is 1626. The stock price of HDFC is 2024 per share, this means, 1626 out of 2024 cannot be explained by the regression equation. This means, the regression equation cannot explain nearly 80% (1626/2024) of Y’s stock price or in other words the equation can explain only 20% of the equation, which according to me is quite tricky.

This further implies, that if we are trading this pair, then we are essentially trading a very small probability here. I’d rather avoid this and look for another opportunity than trade this. Of course, I know traders who would love to jump in and take this trade, but for someone like me, I’d look at risk first and then the reward ☺

Good luck!

# 272 comments

View all comments →
1. Kalpana says:

Thanks for the further insight

• Karthik Rangappa says:

Good luck, Kalpana.

2. KUMAR MAYANK says:

Hello sir
I have a doubt.
HDFC= 0.79*ICICI+ INTERCEPT+RESD
For every 100 shares of ICICI we need 79 shares of HDFCBANK. 1 Lot (ICICI)= 2750. Thus we require 2750*0.79 or 2172 shares of HDFCBANK. Therefore we need 2172/500 or 4 lots (approx) of HDFC to trade.
1 lot of ICICIBANK and 4 lots of HDFCBANK, i think, is a combination.
Thanks

• Karthik Rangappa says:

For every 0.79 shares of ICICI, we need 1 share of HDFC. Given the lot size of ICICI as 2750, we need 2750/0.79 = 3481 shares of HDFC, therefore rounded off at 3500.

• KUMAR MAYANK says:

Thank you, sir. I got it.

• Karthik Rangappa says:

Cheers!

3. Thirumal Sharma says:

Hi Sir. Thanks for bringing in another angle which we couldn’t think of. Its like inhaling a trading wisdom!

Just wanted to find out below;

– What are chances of getting stopped out say for ex: out of 100 trades (Just to asess success rate) both in 1st method pair trade method (correlation) and 2nd method (regression).

• Karthik Rangappa says:

I’ve stopped using the first method long ago, Thirumal, and for the 2nd method, I think the success ratio is fairly higher something around the region of 6 of 10 trades working in your favor. The key here is to keep a sharp eye on risk parameters.

• Thirumal Sharma says:

Thank you for the information sir

• Karthik Rangappa says:

Welcome!

4. Akshay Hire says:

What intercept value is right you think?? Pair I am tracking explains 71.83 of NIFTy(y).

• Karthik Rangappa says:

70-80% or higher is a good equation according to me. I’d be hesitant below that.

• Akshay Hire says:

In today’s session it fell down to 63% , Do you think I should wait before it jumps back above 70% to take the trade.

• Karthik Rangappa says:

Yes, that would be better, Akshay. Better safe than sorry 🙂

• Akshay Hire says:

Hey Karthik,
Just wanted so Thank You, since you started this pair trading chapter I spent most of my time thinking about perfect pair trade setup.
I have finally found out using multiple regression method an equation that explains almost 99% of dependent variable.
Is it too perfect to be true?

• Karthik Rangappa says:

99% seems too good to be true, Akshay 🙂
Which pair is this?

• Akshay Hire says:

I am using more than one independent variable to predict just one dependent variable, like using few heavy weights to predict Index.

• Karthik Rangappa says:

Yes, this is possible in a multivariate regression. But we have not really discussed that here 🙂

• Akshay Hire says:

I tried using regression concept between two stocks but it was quite difficult to find stationarity, so I reduced my time frame & used multivariate regression. This is providing better results & stationarity.

• Karthik Rangappa says:

Nice, good luck Akshay!

5. Deepu says:

Hi Karthik,

Amazing write-up!!!

Just a query on hdfc hdfc bank pair. In last 15 days there was a deviation but it never reverted which is strange given it is a highly co-integrated pair.

Request your detailed analysis as a live example on this pair:

1. Whether trade was there in the first place ?
2. Which date would have been the best entry ?
3. Did it hit the stop loss? What should be the SL in such cases ?
4. Is averaging suggested if it moves against you ?

Thanks in advance.

Regards
Deepu

• Karthik Rangappa says:

Deepu, I don’t track HDFC and HDFC Bank as a pair so I wont be able to answer this question.
On your query with averaging, no its not a good idea to average it out. Not just with pair, but every other trade.

View all comments →