Module 10 Trading Systems

Chapter 7

PTM1,C5 – The Pair Trade


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 2nd 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 –

  1. 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
  2. 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 2nd 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 2nd 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 2nd 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 –

  1. The density curve of 0.16 implies that the corresponding value is at the -1 standard deviation below the mean
  2. The density curve value of 0.84 implies that the corresponding value is at the +1 standard deviation above the mean
  3. 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 – 1st 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 –

  1. 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
  2. The ratio value changes daily, based on the stock prices of Axis Bank and ICICI Bank
  3. The ratio and its corresponding density curve value has to be calculated daily

The trading philosophy is as below –

  1. 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
  2. Any change in the business landscape will affect the stock prices of both the companies
  3. 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
  4. 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 2nd & 3rd 0.25 or lower 0.003 or higher
Short Between 0.975& 0.997 Between 2nd & 3rd 0.975 or lower 0.997 or higher

The idea is to initiate a trade (either long or short) when the ratio is between 2nd and 3rd standard deviation and square off the position as it goes below the 2nd 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 25th 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 –

  1. A long trade requires you to buy Stock A and Sell Stock B
  2. A short trade requires you to sell Stock A and Buy Stock B

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

  1. Buy Axis Bank @ Rs.473
  2. 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 3rd 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
25th Oct Axis Bank Buy @ 473 1200 31st Oct Sell @ 523 50*1200 = 60K
25th Oct ICICI Bank Sell @ 305.7 2750 31st 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 9th 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 8th 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
9th Aug Axis Bank Sell @ 574.1 1200 8th Sept Buy @ 571 3.1*1200 = 3.72K
9th Aug ICICI Bank Buy @ 245.3 2750 8th 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.

  1. Everything we have learned so far accounts to about 25% of what I intend to discuss going ahead
  2. These first 7 chapter discusses a very basic pair trading technique, mainly to help lay a foundation
  3. We have not adhered to strict trade definitions – stop loss, targets etc. If you notice, I’ve kept things quite generic
  4. Neutrality of both the positions is a key angle, we have not discussed that yet
  5. We are yet to discuss the risk associated with Pair trading
  6. Pair trading is a margin money guzzler, so one needs to have sufficient funds to pair trade, but the P&L is worth it
  7. 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

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


  1. Pradeep says:

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

  2. Lalit Singhal says:

    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….??

  3. Onkar Shinde says:

    One can use to find out about companies with similar business.

  4. Onkar Shinde says:

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

  5. Arpan says:

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

    • Karthik Rangappa says:

      Starting next week, hopefully.

      • Arpan Patra says:


        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 🙂

        • Karthik Rangappa says:

          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.

  6. Akash Patel says:

    Sirji, nice article.
    i m using z-score/BB with 2&3 SD to initiate trade, instead of Density Curve. is it go? and doing well. i got this idea from “” long time back. that is doing good for me. please give your valuable inputs.

  7. Saurabh Patel says:

    Hi Karthik,
    First – your articles are really good for a beginner.
    We can do pair trade only on futures, as we have to short one of the instruments.
    I’ve a few doubts:
    1. we’re using stock prices to calculate density curve, and we’ll be trading futures, so would that work fine?
    2. As we saw that the pair trade was open for around a month, so how do we know which month’s future should we trade in?
    2. Lot sizes are different here, so is it possible that due to that difference, sometimes loss might turn out to be more than profit, if the losing future has significantly higher lot size than the winning one.
    3. If we’re doing this in futures, then is it possible to execute this opportunity with options? (one call and one put, probably first/second month expiry, and choosing strikes as to minimise the margin).

    • Karthik Rangappa says:

      1) Yes, that is absolutely fine.
      2) Great point – always opt for current month contract, be prepared to roll over if required.
      3) Yes, hence the concept of Rupee neutrality. Will talk about this in detail as we move forward
      4) Nope, when it comes to pair trading, the emphasis is on the price movement, which is captured by futures. Options has many other forces acting on it besides the price movement – like volatility and time.

  8. Shivansh Juneja says:

    When we go long or short why do we use the numerator as the main thing?

    • Karthik Rangappa says:

      The numerator thing was only to help the reader remember which stock to buy and sell when going long or short on the pair 🙂

      • swapnil says:

        Suppose while tracking the pair I used axis bank in numerator and icici bank in denominator & trade signal generates to buy the pair.
        while taking this trade I need to buy axis and sell icici, can i do the opposite?

        • Karthik Rangappa says:

          The trade is always with respect to the denominator. So buy ICICI and sell Axis. I’d suggest you check out the 2nd method to pair trade.

  9. Gary says:

    Hi Karthik,
    You have a natural flair for explaining a complex subject in a very lucid manner, really appreciate you doing it.
    That said I have a question:
    Why do the pair trading, just go Long whichever one of the two has deviated the most. Since it will give you the biggest bang for the buck (Rs) once it reverts back to it’s mean. Just a thought…………
    Keep up the good work.

    • Karthik Rangappa says:

      Remember, you are trading a ratio here and not really the stock. A ratio is defined by the stock prices of two different stocks, hence it is mandatory to go long and short at the same time. If not, this will be a naked position, which can be quite risky.

  10. Deepu says:

    Thanks for the excellent write-up once again. Feeling privileged.

    Couple of queries:
    1. Do we need to keep the number of count of the data to 496 or it should keep on increasing as we add the current data ? What is the ideal count of data range to look for ongoing basis ?

    2. Can we get the complete table of the density curve and the corresponding Standard deviation ? What does .49 or .25 density curve will signify ?

    Thanks once again.

    Eagerness to know when the next chapter is coming up:)

    • Karthik Rangappa says:

      1) You need to update the data every day to see the latest value of the ratio and density curve. You need to look back for at least 1 year, 2 will be great
      2) Will try and do that sometime soon.

      I’ll target to put up the next chapter sometime this or next week max.

      • Deepu says:

        Hi Karthik,

        Request your input on the below:

        Can we get the complete table of the density curve and the corresponding Standard deviation ? What does .49 or .25 density curve will signify ?

        Thanks in advance

        • Karthik Rangappa says:

          I’ve summarised the table with few important points that matter. Will try and put out the entire table, although I think that may not really be required.

  11. Anand says:

    Hi Karthik
    I wanna read the all Chapter in Hindi because I am more comfortable in hindi as compare to English, so what to do for this? Please reply me

  12. SAMIR says:

    Could please provide a list of equities/indices in Indian market that have good correlation and can be considered as good candidates for pair trading.
    Thanks and regards,

    • Karthik Rangappa says:

      That would be tough call, Samir. You will have to identify this – for example, maybe IndusInd Bank and Yes Bank have good correlation. Or stocks like Ambuja – ACC, ITC – HUL, Dabur-Marico etc.

    • Ganesh K says:

      you will find mot highly correlated pairs in private banking space.

  13. rahul says:

    can we use this for option….

  14. tarun says:

    Sir How to decide the target and stop loss.

  15. Shikhar says:

    Happy to see you open this subject for us. Thanks Sir..And Sir kindly suggest a good software to do all this data collection and calculation.

  16. Prem says:

    Hi Karthik,
    Very nice material on Pair trading. Is there any software which provides density curve and other variables mentioned by you?

  17. Sundeep says:

    Sir do you think pairs trading still has relevance in Indian markets? If more people do the same don’t you think the opportunities will almost diminish over the time? I’ve never traded pairs and am just curious. Do you think they’re still profitable?

    • Karthik Rangappa says:

      I understand what you are hinting at. The effectiveness of the pair trading really depends upon the way you define pair trading. Most people I know employ simple pair trading strtagies. I dont think this has any relavence in today’s market circumstance.

  18. puneet says:

    sir, is there any way we can capture the difference between the sopt price and futures of a security eg. Nifty. for eaxample lets say Nifty spot is at 10700 and nifty futures is at 10720. on the day of expiry both the prices converge and we keep the difference.


    • Karthik Rangappa says:

      Not always, but you can sometimes. But then this a space where algos are quite active, I quite doubt the retail participants can capute this effectievly.

  19. Sundeep says:

    Sir can you name few other statistical arbitrage techniques like pairs trading?

  20. Rajib says:

    Please rectify your Density Curve Table (with corresponding Sigma).
    Thanks & Regards,

  21. Tushar says:

    Hello Karthik,

    I’m associated with Zerodha since last two years and active trader on your platform. I regularly read your articles and they are adding great value to the knowledge.
    Appreciate if you could write an article on arbitrage opportunities available for retail investors and how one can spot that? Do we mandatorily required software to generate arbitrage signals?

    Waiting for your reply
    Many thanks in advance

  22. Yadnesh says:

    Hi Karthik, thanks for the information. My query is- how much historical data(in terms of past dates closing prices) we should consider while performing standard deviation study of the stock in general, does data for longer duration considered good over short span. Also, will the trend of stock impact on this study?

    • Karthik Rangappa says:

      I’d suggest a look back period of at least 1 year. Ideally, the trend should not impact, because both the stocks would have behaved the same.

  23. Nikhil says:

    Hello Karthik,
    Margin required to take this trade of ICIC and AXIS is actually 1.9L when I checked in margin calculator. According to this, returns from this kind of trade are pretty good. I also wanted to ask you if there is a way to find out the amount of loss a trader could suffer in case the stoploss triggers?

  24. AP says:

    Karthik, in section 7.2, the table has wrong values for ‘density’ values (actually cumulative probabilities) and the SD values. For instance, you associate density value of 0.16 with +1 SD and 0.84 with -1 SD. It should be the other way.

    • Karthik Rangappa says:

      Dont know how I missed this one, thanks. Have made the necessary changes.

      • AP says:

        Karthik, now the target and stop-loss values in the table in section 7.3 don’t look right. The long entry-trigger (Between 0.025 & 0.003) also satisfies the Target (0.25 or lower) and Stop Loss (0.003 or higher) conditions simultaneously. I think they should have been “0.25 or higher” for Target and “0.003 or lower” for Stop Loss.

        Also, the target for short position is too close to entry. If it is symmetrical to long position, the target would be 0.75 or lower (instead of “0.975 or lower” mentioned in the table).

  25. Jay says:

    How to take the trade ? Wait till the said density curve? Not all times the exact value comes

  26. Rajib says:

    Whats the time frame should one used to derive correlation n stand deviation? Like in some cases if we test correlation from 2005 to till date the correlation is lets say 0.5 but while testing it from 2014 its 0.8 again differ if test from 2017. So ideally what should be the lookback period? You can find this sort of different readings in many pairs specifically in metal n real estate sectors of F&O segment.
    Thanks in advance.

    • Karthik Rangappa says:

      Ideally, you should look at 6 months, 1, year, 2-year correlations to get a sense of the shift in correlations. A pair is considered highly correlated if they the numbers display consistency.

      • Rajib says:

        Got it…So if any pair showing a shift towards more correlation say from 0.56(2 year) to 0.67(year) to 0.78 (6 months) and 2nd different pair showed a shift like 0.79 (2 years) to 0.72 (year) to 0.67 (6months) then I should give more weightage to the first pair rather than 2nd one though the long term correlation of 2nd pair is much more than the 1st one…. correct me if I wrong…
        Thanks & Regards,

        • Karthik Rangappa says:

          Absolutely, the correlations should show consistency in change.

          • Rajib says:

            sorry to disturb you again… while calculating sigma to evaluate normal distribution curve which data set should we use…6 months or year or 2 year…
            Thanks& Regards,

          • Karthik Rangappa says:

            You can run this similar to correlations (because sigma also changes) – so 6 months, 1 year, and 2 years.

  27. Tarun Taragi says:

    Sir if density curve value is greater than 1,then what to do?
    As i have made corelation on IGL& GAIL . And i have taken 2 years data.
    But on most the days there density curve ratio is more than 1 even some case more than 2.

  28. Rajaram says:

    Hi Karthik,

    The density curve table and its values corresponding to the standard deviations, are the values standard. I mean irrespective of the underlying security, should we use the table as a guideline to initiate a trade.

    Is there also a trigger price or entry trigger of these trades. Do we enter the trade the next day, based the closing prices.


    • Rajaram says:

      I also see a discrepancy in the trade that you had depicted.
      9th Aug Axis Bank Sell @ 574.1 1200 8th Sept Buy @ 571 3.1*1200 = 3.72K
      8th Sep Axis bank value is 619 atleast the spot price, not sure on how is it depicted at 571. I’m not sure if the future premium is going to be in that range. Similar issue I see for ICICI in 2016

      • Karthik Rangappa says:

        I’ve taken the spot prices to calculate these, Rajaram. I’ve not looked at futures. This is with the assumption that the futures would depict values similar to spot.

    • Karthik Rangappa says:

      Yes, the values are standard. You have two options – either to initiate as and when the density curve values trigger or initiate around the closing. By the way, I’d suggest you look at the regression-based pair trading technique.

  29. vineet kumar says:

    Karthik Sir

    Sorry to correct you, but the value of axis bank and icici bank taken by you are wrong, because on 9th of august the value of icici bank is around 225 and axis bank is around 575, same is on 8th september the value of axis bank is around 619 and for icici its around 245, please correct me if I am wrong sir


  30. Shyamal d dattani says:

    hi . any body using screener by in ???

  31. KUMAR MAYANK says:

    Hello sir
    I have a confusion. We can trade using correlation method discussed here only when the data series of ratio is stationary around its mean. How could we know whether the ratio is stationary time series data? Can you help me so that i could draw a graph of ratio-time series on excel?
    Varsity student

    • Karthik Rangappa says:

      You need to run an ADF test for this, Mayank. I’ve explained more on it the latest chapter.

      • KUMAR MAYANK says:

        So what i need to do is to select a strongly correlated pair of stocks, find the ratio of their closing prices and then run AFD test on time series data of ratios to know if they are stationary or not. If i get to know that the data has high probability of being a stationary time series then only i should look for an opportunity to trade by tracking density curve. Am i correct?
        Varsity student

        • Karthik Rangappa says:

          Mayank, I think you are mixing up both the techniques. Chapter 3 – 7 is 1st method, and 8 onwards is another method involving ADF.

          • KUMAR MAYANK says:

            I am talking about the first method (based on correlation). What I want to say is that we can trade only when the ratio reverts back to its mean and it (reverting back of ratios) is possible only when the data series of ratio is stationary around its fixed mean. If data series of ratio is non stationary it may drift away from its mean having variable mean and variance. And if it is so then how we could apply the concept of mean reversion on non stationary time series data (here data is ratio)? I guess our first aim should be to find whether the ratio is stationary or not. Am i clear to you, sir?
            Varsity student

          • Karthik Rangappa says:

            Ah, now I get it. Yes, that makes sense. YOu can check for the stationarity of the ratio series in the same way, as in use the ADF test. If the series is stationary, you can look for trading opportunities. However, I’ve not done this Mayank, so cannot really comment on the outcome. Good luck and do share the results with us. Thanks.

  32. KUMAR MAYANK says:

    Hello sir
    Thanks for your prompt reply! I don’t have an ADF plug in so i couldn’t test the stationarity of the ratio series. But i did plot the graph of ratio-time so that i could visualise if it behaves like stationary time series or not. Here is the link of screen shot.
    It almost behaves like a sine or cosine graph with a slightly trending mean. Next i plotted its frequency histogram to visualise if it fits in the normal distribution plot or not. Here is the link.
    I find it doesn’t fit perfectly in the normal distribution plot. Now my question is: 1. Is it acceptable to consider this plot as normal distribution? 2. If not, then how could we apply the concept of std. deviation and density curve on ratio series data? I have tagged you in a twitter post of mine for the same query.
    Varsity student

    • Karthik Rangappa says:

      Guess you tagged me on Twitter as well 🙂

      This looks like an ND for me, just that its skewed to the right (sorry, I guess I said left on twitter).

      • KUMAR MAYANK says:

        Well, this normal distribution is skewed. Can we still treat it as ND and apply std dev on this data series?

        • Karthik Rangappa says:

          Yup, you can. I’m keen to know the outcome, so please do share the results here. Thanks.

          • KUMAR MAYANK says:

            Hello sir
            I have have installed EViews statistical package for one year trial period 🙂 In the “lag length” drop menu of ADF test section there are many options available like Schwarz Info Criterion, Hann-Quin criterion, Modified Akaik, T- static each giving different P value for the same max lag of 15. You may see it here:
            Even it gives value below the threshold value of 0.05 the header reads as Null Hypothesis: Residual has a unit root. If the series has a unit root how could it be a stationary series? I have taken a screen shot here:
            Varsity student

          • KUMAR MAYANK says:

            Hello sir
            I run the ADF test on the pair data downloaded from varsity. In the lag selection i checked the automatic lag selection header. So by Schwarz Info Criteria (SIC) and lag length 17 the p value was noted 0.2489. By other criteria but with the same lag length of 17 the p value remained 0.2489. I run ADF test on ratio of different set of pairs but all were non stationary even though the pairs were co-integrated. I guess trading on just ratio is not as much convincing as one based on regression analysis.
            Varsity student

          • Karthik Rangappa says:

            Exactly, hence the reason why I prefer the 2nd method!

  33. Debasis Mukherjee says:


    Can we use the Pair Trade method to any stock and its future pair? Just today I saw Titan was down, but Titan May Fut was down about 0.3% more. But now the difference is only 0.06%. If we use same stock and its future then residual calculation may not needed as same stock and its fut is more co-related than two different bank.

    With regards

    • Karthik Rangappa says:

      You can use it across any two different stocks which exhibit pair trading characteristics. The same stocks and its futures is more of a cash and carry arb.

  34. Anand says:


  35. Anish says:

    Hi Karthik,

    To calculated the mean and SD in the sheet “Pair Data” you have used data for Axis and ICICI from 4th Dec 2015-4th Dec 2017. And you are using that mean and SD in to find the position of the ratio in the ND curve. Isnt that incorporating data from the future to trigger trades in the past ?


  36. swapnil says:

    Dear Karthik,

    1. There are many stocks which are from different sectors or having difference businesses still showing good correlation.
    Can we you such pairs for pair trading?
    example. adniports and bajajfinance, adniports and hindalco, adaniports & LT.
    ASIANPAINT & HUL, BAJAJ-AUTO & bharti airtel.
    As of now I am only considering correlation not rupee neutrality.

    2. Can I use nifty 50 stocks with nifty next 50 stocks to find pairs?

    Please suggest.

    • Karthik Rangappa says:

      Yes to both your queries, Swapnil. In fact, one of the thoughts is that you should not really be subjective while selecting pairs. You should go with the numbers. I’d suggest you give this approach a try.

  37. Sebastine says:

    I think it is a typo in the above chapter: “Hence we sell Axis Bank (numerator) and sell ICICI Bank (denominator)”. I think it should be Buy ICICI Bank here.

  38. Priya says:

    Do we not use correlation here beyond identification? For highly correlated stocks like tata motors and tata motors dvr CP corr – 0.99 returns correlation – 0.91, do we have a relaxation of the norms. for in a period of 250+ days, I found exactly only one data point that falls in the upper criteria and none in the lower.

    • Karthik Rangappa says:

      Well, perhapse in the case of TM and TM DVR. But its always safer to run by the corr for other pairs.

      • Priya says:

        Sorry my question was not clear. the 2 SD showed only one opportunity. I see a few dozen in 1SD… would that be too risky ? or is it ok relax the 2 SD rule a bit to 1.5 SD or something ?

        • Karthik Rangappa says:

          Ah like that. No not at all, as long as you have some past stats on the behaviour.

          • Priya says:

            grt. thx. there was a 2 SD opportunity today and I have opened a trade, will update you as and when I close it on how it went. Excited 😀

          • Karthik Rangappa says:

            Good luck, Priya. Make sure you check all the stats well before the trade. Let us know 🙂

Post a comment