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.



415 comments

  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 http://www.screener.in 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:

        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 🙂

        • 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 “https://www.tradingfloor.com/posts/has-equity-pairs-trading-had-its-day-6291833” long time back. that is doing good for me. please give your valuable inputs.
    thanks.

  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
    Thanks

  12. SAMIR says:

    Karthik,
    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,
    Samir

    • 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.

    Rgds

    • 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?

    • Karthik Rangappa says:

      I’m in the process of explaining one, the next chapter will the first installment, will be out next week.

  20. Rajib says:

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

  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).

        • Karthik Rangappa says:

          Ahhh, I think with the table, the other things also got messed up. Let me relook at this. Thanks again 🙂

          • priya says:

            Karthik, the tables dont seem to be updated yet. So am a bit confused about the long part of the trade. Pls update. thx

  25. Jay says:

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

  26. Rajib says:

    Kartick,
    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.
    Rajib.

    • 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,
        Rajib.

        • Karthik Rangappa says:

          Absolutely, the correlations should show consistency in change.

          • Rajib says:

            Kartick,
            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,
            Rajib.

          • 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.

    Regards

    • 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

    Thanks

  30. Shyamal d dattani says:

    hi . any body using screener by pairtrade.in. 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?
    Thanks
    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?
        Thanks
        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?
            Thanks
            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.
    http://prntscr.com/jcuo7x
    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.
    http://prntscr.com/jcus56
    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.
    Thanks
    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?
        Thanks

        • 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:
            http://prntscr.com/jdu0xn
            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:
            http://prntscr.com/jdu7m4
            Thanks
            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.
            Thanks
            Varsity student

          • Karthik Rangappa says:

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

  33. Debasis Mukherjee says:

    Sir,

    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:

    AS PER THIS METHOD THERE IS A LIVE EXAMPLE OF BUY VEDL SELL HINDALCO IN MKT RIGHT NOW USING LAST 1 YEAR DATA

  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 ?

    Thanks

  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 🙂

          • Priya says:

            Hey Karthik , I closed the trade yesterday after 11 days and 1 rollover. a 2.5 % return, not bad for a hedged position. It did quite test me with expanding a lot more before it started coming together. I should have listed to you and waited till 2.5 SD to initiate, would have fared better. Thanks much though. I could sleep well even with a open position due to the natural hedge 😀

          • Karthik Rangappa says:

            Good luck, Priya. Hope more profits roll your way 🙂

  39. swapnil says:

    Dear Karthik,

    Which parameters need to be consider while selecting stocks for pair trading?
    The one you already mentioned is stocks from same sector or business.
    Any other parameters?

    • Karthik Rangappa says:

      Ideally, they belong to the same sector and of similar size.

      • swapnil says:

        Can I use stocks from different sectors showing good correlation?
        Please suggest.

        • Karthik Rangappa says:

          Check out Banks, automobiles, and metals.

          • swapnil says:

            Thank You.

          • swapnil says:

            Suppose I have taken a position which is currently in loss and now there is expiry and I don’t want to square off my position,
            can I rollover this position to next month contract?
            Should I rollover it?
            Any risk in rolling over it?
            How many times I can rollover it?
            Any way to recover this loss from same trade?

          • Karthik Rangappa says:

            You can rollover, and you can rollover as many times as you’d want. However, rollover does not guarantee recovery from a loss-making trade.

  40. swapnil says:

    Dear Karthik,
    How to decide final pair for trade if there is a tie between two?
    Which factors need to consider?
    Please guide.

  41. prathik says:

    Sir, how do i conclude if two stocks constitute a pair so that if they are not a pair i can skip tracking them daily for opportunities.I want to use the pair strategy discussed in this chapter.

    • Karthik Rangappa says:

      Pick up stock belonging to the same sector (like BPCL-HPCL, Infy-TCS, Tata Motors-Tata Motors DVR etc), you will have a greater chance of finding pairs that make sense.

  42. JAYA says:

    WHEN YOU WILL TEACH Rupee Neutrality ?

    • Karthik Rangappa says:

      I’ve not practiced Rupee neutrality, so I guess I’m not the right person to talk about that strategy.

  43. RAYEN DIAS says:

    Data points must be fixed or variable ( say i have data of 100 days,is it necessary to stick with it or i can add up the present day data without deleting the 100th day )

  44. Virendra says:

    Pls help why is it that copper and lead have 0.9 correlation but copper mini and lead mini have 0.45 correlation?

  45. nikhil says:

    Hello
    Is this method not good enough to trade? Do I have to try the second method you wrote?
    Second method seems to require some tools and knowledge about coding and stuff which I dont have..
    Which method do you recommend ?
    And if you could mention some pros and cons between these two pair trading methods..?
    Thank you sir.

    • Karthik Rangappa says:

      Nikhil, both the techniques are quite good, although I prefer the 2nd one. The first one is simple to implement and involves basic stats while the 2nd one is stats heavy. This is the only difference.

  46. nikhil says:

    Hello,
    Sir I have tested some pairs and found that some pair with correlation of 0.4 and 0.5 also works well.. Is this correlation number enough? And also some pairs with high correlation like 0.9 or 0.85 does not give good results? Could you throw some light on this please….
    Thanks Sir.

    • Karthik Rangappa says:

      Correlation is not necessarily the best way to pair trade, Nikhil. Do check the other method later in the module.

      • nikhil says:

        Sir I have read the second method also but I dont have enough tools or knowledge about programming…
        So I stared to test some of the pairs from this first method.. Seems to work well but the above question still remains….

        • Karthik Rangappa says:

          Thats ok, Nikhil. If it works for you then it is good..but do keep a close watch on the risk.

  47. Avinash says:

    Why Stock A is Axis Bank and Stock B is ICICI bank? Can’t we flip them( stock A – ICICI and Stock B – Axis)? What is the reason behind this? Is that the price of Axis is higher so are you using it as numerator?

  48. avinash says:

    Tried Pair trading for TATA MOTOR and TATA DVR ( stock A- tata motor and stock B -tata Dvr).
    At density curve value – 0.035 – Stock price of Tata motor – 448 and Dvr is 273
    When the Density curve value reached – 0.25, Price of Tata motor and Dvr are – 384 and 227 respectively.
    In this case, It would be a loss if we buy one and sell other. Any solution for this?

  49. Neehar says:

    Hi Karthik,
    Is it possible to identify such an opportunity with streak? (finding ratios and density values etc) Also I wanted to ask whether you have any plan to start a module on ‘Quantitative Trading’ (Basics)because I am sure many people like me are very much interested in it.

    • Karthik Rangappa says:

      I’m not sure if this is possible via Streak. Let me check though. QA is on the agenda, but I’m not sure if I will be able to do justice. Trying to see if I can find a collaborator for this.

  50. Sumit says:

    Karthik I’ve been trying to read on Quantitative Trading and without much success. What are some other kinds of Quant Trading Strategies other than Pairs Trading? Where do I get started?

    • Karthik Rangappa says:

      Sumit, Pair trading itself can be done in multiple ways. Did you read the 2nd method to Pair trade? Else, I’d suggest you take a look at it, we have discussed the same next chapter onwards.

  51. Aniruddhsinh Rathod says:

    Hello,

    I think i have found two typos in the chapter:(Correct me if i’m wrong)

    1) In the table of general guidelines of pair trading for long position the target should be 0.025 or higher and stoploss should be 0.003 or lower.
    2)In the example of short pair trade it is written that sell axis and sell icici both.

    THANKS

  52. Gomsi says:

    HI Karthik,
    Very Informative chapter. Keep up the good work!!
    well as far as Pairs Trade chapter is concerned , i have heard market people talking about the term Z Score in Pair Trading
    can u please throw us some light on that and how different it is from Density curve which we use.

    Thanks..

    • Karthik Rangappa says:

      Z score is nothing but the divergence from the average. It tells you where the standard deviation is….for example, 1.5SD away from mean or 2 SD away from the mean etc.

  53. Thimmappa says:

    Sir. Many thanks for such wonderful insights. Does the first method still works? If so any idea what is the win loss ratio?
    Thanks again!

    • Karthik Rangappa says:

      Methods still work, Thimmappa. However, you will have to improvise on them over time and calibrate it to your risk-reward temperament.

  54. Thimmappa says:

    Thanks for the response sir. Can we expect some more systems in this chapter?

  55. Thimmappa says:

    Ok sir thanks.

  56. ROHIT GUPTA says:

    Dear Karthik,
    I think I should trade pair trade of method 1 instead of method 2 because I have not got ADF test. What do you think, can I make consistently by using method 1 of paid trade? Pl reply me soon.

  57. Rohit Gupta says:

    I want to learn how to find ADF test. So I want to ask whom can I meet personally in Delhi to learn ADF test please? Pl reply me soon as I am going to Delhi for some personal affairs this week.

  58. ROHIT GUPTA says:

    If you prefer M2 then at least pl help me where to find ADF test so that I trade based on M2 because I have trading account with Zerodha.

  59. Ajay says:

    Hi Karthik,

    Can I keep rolling a pair trade for many months until it eventually breaks even?

    Took a pair in Nifty & Banknifty but it went opposite to my estimate. Sitting on a big loss.
    Now I need to decide whether to roll over or accept losses. My thinking is that as it must mean revert sometime in next months, so can I roll it over to next expiries and wait ?

    In your experience, do such a trade eventually breakeven sometime in future (even if needs rolling it for 6 months)?

    • Karthik Rangappa says:

      You can Ajay, as long as you have a deep pocket to hold. However, if the spread diverges to 3SD or beyond, it is better to exit and book a loss.

  60. Ajay says:

    Thanks Karthik. You are right, I could have recouped some losses if I had rolled over on Expiry day as
    Banknifty has again started outperforming Nifty since last 2 days…..(I was long BN). It was opposite for 10 days before that…
    When I took the position (BN- long, N-short) , the spread (ratio based) was around -1.5 SD around 10 July.
    I took the trade thinking it will probably continue towards -2 SD atleast.
    But it reversed from -1.5 SD and came close to mean 2 days ago.
    Now instead of crossing the mean and going towards +ve SD, it seems to be going back again towards -1SD since last 2 days( BN outperforming N).

    I think I will have to read your density curve chapter again to better understand when is it the optimal time to pull the trigger

    By the way, what’s you view : Will BN keep outperforming N for next few days?

    • Karthik Rangappa says:

      Yes, there are two important things here – maintaining SL at 3SD (or at whatever level you think is good) and to allocate capital in such a way that we have a decent buffer for drawdowns.

      Not sure about BN 🙂

  61. ROHIT GUPTA says:

    I have studied http://www.real-statistics.com/time-series-analysis/autoregressive-processes/augmented-dickey-fuller-test/ recommended by you but I got no understand from where to start and where to find ADF test value. Pl tell me the details and help me.
    Thanks

  62. ROHIT GUPTA says:

    I was awaiting for your reply regarding ADF test which you would look up again and will tell me but I got no response till date. Pl help me as I have stopped trading intraday or swing trading because I am getting loss. So I want to trade on pair trade of method 2 but I have not understood properly how to use ADF test.

    • Karthik Rangappa says:

      Rohit, I’m unfortunately not in a position to give you a commitment on this. I’m looking for sources as well.

  63. ROHIT GUPTA says:

    Then how do you do pair trade of method 2? You yourself told that the method 2 is best for pair trade if you don’t know how to use ADF test? How can you tell this method is best?

  64. ROHIT GUPTA says:

    Very Thanks for giving me information. But before purchasing, I want to ask in the following lines:
    1. Is the site given by you reliable?
    2. Which type of purchasing should I whether commercial or student/non-profit as I am an individual?
    3. If I purchase this, would I be able to install without problem? As I tried to install ADF test from Realstatistics resource pack but it has got problem I tried to solve but failed? Please give me suggestion so that I would not get wasted of money.
    4. I have read the example of how to use. What parameters should be given in ADF test like Length, options, test_down,alpha, return_type etc?
    Thanks again for replying me.

    • Karthik Rangappa says:

      1) I dont know since I’ve not used the site. I’d suggest you look up for online reviews
      2) You will have to self assess that 🙂
      3) I guess so. Since this is a paid version, you are also entitled to get support from them. Maybe you should write to and clarify all these things before buying
      4) I need to understand the context of these parameters, Rohit.

  65. ROHIT GUPTA says:

    I have installed spiderfinaancial.com. I want to ask you for ADF test
    1. which parameter i.e. price or daily % return be used?
    2. To satisfy ADF test, should either of individual stock be less than 0.05% or both stocks be less than 0.05%
    3. What should be number in lag order?
    pl reply me soon

    • Karthik Rangappa says:

      Rohit,

      1) If it is for pair trading, it has to be on the residuals and not on stock prices or returns
      2) 0.005% of what?
      3) Lag order should be the cube root of the number of data points i.e if you have 1000 data points, then the lag order is 10.

  66. ROHIT GUPTA says:

    sorry to disturb you once again. I want to ask one more question in addition to above my questions, how to evaluate ADF test the combination of both stocks. As in the spiderfinancial , only one stock is accepted for ADF test.

    • Karthik Rangappa says:

      So like I mentioned in my previous comment, use the residuals (single time series) and not stock returns or the prices.

  67. rohit gupta says:

    Very very thanks for replying me. I got your point. My last question: What variables should I choose viz no constant and no trend, constant and no trend, constant and trend? What these variables mean and which to choose which is given in the output of specialfinancial.com after run ADF test? Again many thanks for getting response.

  68. Dipesh Koyande says:

    Hello Sir,
    First, I would like to thank you for providing us brief knowledge about trading in such amazing way which can be understood by even by novice trader.
    I have a question regarding pair trading.
    Can we use this technique in other instruments such as commodities?
    If yes then how?

    • Karthik Rangappa says:

      Thanks Dipesh, glad you liked the content. Yes, you can use the technique on commodities as well.

  69. Yuvraj says:

    Sir, i have 2 queries:
    1) can we follow the same method for a strong negative correlation between two stocks?
    2) do you think following this method for Nifty and Bank Nifty would be a good idea?

  70. Yuvraj says:

    Great!
    And now the question from which i hope to learn the most:

    How do you manage your time between responding to each query on varsity across so many chapters so promptly, writing new chapters, indulging in own trading and investing activities, doing other office work (being the VP of equity research), staying up to date with the business ecosystem, and of course, managing your personal time?

    PS – the most valuable asset for anyone – time

    • Karthik Rangappa says:

      Yuvraj, I’ve stopped actively trading the markets. It’s impossible to manage that with everything else. I mostly do long term equity and MF investing, which is not too demanding on a day to day basis. But the other things, guess I’ve just gotten used to it 🙂
      But here is the thing, this is what I’ve observed, the moment you do things that you love, hang out and work with people you are comfortable with, then things start to work automatically, and you won’t have to stress about time 🙂

  71. Yuvraj says:

    I am of the opinion that earning money is not that difficult, but earning respect, on the other hand, is a strenuous task.
    And you have mine, and of many others im sure.
    I know reading this might be a waste of ‘time’ for you, but i thought i’d let you know 🙂
    Cheers, and i hope our paths cross someday

    • Karthik Rangappa says:

      It certainly not a waste of time. Comments like these motivate me to push harder and deliver more, so thanks for letting me know 🙂

  72. Tushar says:

    Hi Karthik, can you please tell me if it is possible to use pai trading on intraday? How those signals to be identified?

    • Karthik Rangappa says:

      I’m not too familiar with PAI trading, Tushar. Can you please point me to some online resource to get some basic insights into this? Thanks.

  73. Tushar says:

    Oh really sorry for the misspell. It is pair trading.

    • Karthik Rangappa says:

      Ah, no problem. You can use pair trading for intraday but you will have to optimize the strategy for intrday.

  74. Tushar says:

    Thanks Karthik.
    Would appreciate some inputs from you on this optimization.Thanks

  75. Tushar says:

    Thanks Karthik for your feedback,
    I have no such plan at the moment.

  76. Tushar says:

    Hi Karthik,
    Your 1st pair trade technique is quite simple. I checked it on quite few pairs and it shows good results if you trade strictly as per your guideline of density curve less than 0.025 (buy) and above 0.975 (sell). in fact it generate buy or sell signals even if the correlation is less than 50% or negative correlation.
    Only the signals are seldom but still are there.
    thanks for the chapters.

  77. Tushar says:

    Hi Karthik,
    I have some questions while working with pair trading.
    1) how old the data points must be considered? I mean, 6 months, 1 year is ok?
    2) in some pairs the 3rd std deviation number is negative. How this can be interpreted?

  78. Tushar says:

    thanks you dear Karthik.
    I must appreciate your dedication. It is unbelievable that you answer within 24 hrs. Response on Sunday was never expecetd!.
    Thank again.

  79. Tushar says:

    Hi Karthik,
    I will be thankful if you could answer my below queries –
    1) While making new pairs I came across few pairs where the density curve value is 0.0004 / 0.9998. So the chance of these pairs to come to mean is more than 99.7%. Right? If yes, Can such pairs be considered for pair trading immediately? The data I have referred to is almost for a year.
    2) Does the correlation really matters when the conditions like similar business, same environment, same competition etc are fulfilled?

    • Karthik Rangappa says:

      1) Assuming the math is right, yes, these are good for trade, please double-check the parameters again
      2) Yes, it does.

  80. Tushar says:

    Ok. Thanks.

  81. Shibashis Datta says:

    Hi, I have tried updating the excel for Tatamotor and DVR. Correlation is
    Correlations
    Close 0.943964754
    % Return 0.968387136
    Absolute change 0.966257418
    Getting this value
    Date Spread Differential Ratio Density Curve (Ratio)
    01-Jan-20 0.000 108.650 2.433 0.992593966

    So, as per logic its good to short script A, long Script B?

  82. Anshul Narula says:

    If I am not mistaken, given the density curve value for normal distribution (0.5 being the mean/mode), the probability can also be calculated in excel directly as:
    Abs(1 – DC*2)

  83. abhinash says:

    hello,
    The knowledge your providing here is awesome .
    Are there any jobs one can get into by having enough knowledge on how to trade/invest,and if so please explain me in detail.
    Thank you sir .

  84. abhinash says:

    please provide any links to explore.
    thank you.

  85. koushik says:

    sir,
    In options, bajajfinsv 4500 PE is now trading at 109.50 .
    Assuming that i had written a bajajfinsv 4500 PE on 16th April when the premium was 252, now how to find out the margin on that day (16th),were today margin requirement at 109.50 is 1,75,990.

    Is this a right way of doing,

    252-109.50=142.5
    142.5*125(per lot)=17,812.5
    1,75,990(today’s margin)+17,812.5=1,93,802.5(margin on 16th)

    please reply
    thank you sir

  86. koushik says:

    thank you sir , but i don’t get it can you once solve the above one.
    please do reply.

  87. koushik says:

    Okay sir got it ,
    thank you.

  88. Yask Rupani says:

    SIR, I have two questions:
    First, while carrying out the ADF test, do we have to find out whether each series of data is stationary or do we do a combined test which means regressing nifty on bank nifty and then regressing the change in residuals on the lagged value of residual?
    Also, while performing the regression, do we take the value of indices or their daily return?

    Secondly, we know that share prices follow log-normal distribution and returns follow normal distribution. So while calculating the metrics i.e differential or spread or ratio, should we consider share prices or their daily returns?

  89. koushik says:

    sir,
    How to enable commodities section in zerodha on online .

  90. koushik says:

    sir,
    How to put FDs as collateral for options selling ?
    Or even other financial instrument.

  91. Rohit says:

    HI Karthik,

    Can we do pair trading by buying and selling stocks instead of trading futures? I understand options would involve a lot more variable hence it is not recommended. Please help to explain the rationale for trading futures

  92. VB says:

    Hi Karthik,
    In method 1, do we trade with equal amounts of shares or equal amount of money ? For eg do i buy 1000 Axis & short 1000 ICICI ( just as an example) or do i buy 10000 worth Axis & short 10K worth ICICI ?

  93. Abhishek says:

    Hi Sir,

    1) What’s the difference between density curve and standard deviation table?
    2) If we check deviation of current ratio value from standard deviation table. Will this be fine?

  94. kk says:

    hi Karthik,
    can we use technical analysis in pair trading to maximize trading opportunity in smaller time frame or use this kind of statistical data on intraday time frames rather than daily close price???

    • Karthik Rangappa says:

      Hmm, not really. Pair trading is based on quantitative observation and not TA so best if is left that way 🙂

  95. kk says:

    okay sir then what are the ways to find more trading opportunity can we use these quantitative observations on smaller time frame??

  96. kk says:

    okay sir in that case do we have to exit on intraday time frame or positional exit which one would be better option??
    thanks in advance

  97. KK says:

    hello sir,
    i have a question in back testing u have already considered closing price of icici and axis bank from dec 2015 to dec2017 and based on that u hv calculated mean,s.d, and density curve, how can we use closing price of all time series which will not be there in the first place so doesn’t that backtest will be wrong if we use values of all time series together?? shouldn’t we use day by day values of mean,s.d, density curve to get true backtest result??? bcz ratio changes everyday so mean also changes everyday so does density curve???

    • Karthik Rangappa says:

      Yes, that’s right. I used whatever was available at the time of writing, you will have to use the latest 🙂

  98. Kk says:

    Ok sir so to get a true picture of backtest result we have to update every days close price,mean,s.d, density curve in the backtesting also in the selected data series ri8??

  99. VB says:

    Hi Karthik,
    I am using Z-scores (-2.5 & beyond as a BUY & 2.5 & beyond as a SELL) for the pair. Tweaked it to -3/3 as well. I am saying, does the Z-score apply to stocks too. For eg if Bharti Airtel current Z-score is say 3.48, can it indicate a SELL Airtel signal ?

  100. Inder k says:

    sir
    sir what is use of calculating MEDIAN and MODE in this method

  101. Rajesh Kumar V says:

    How to use pair trading in Intraday? one of the person is doing pairs in intraday but refused to reveal the strategy.

    • Karthik Rangappa says:

      There is no separate way to do this, Rajesh. You can run the same method for intraday. The problem is that the pair trade may not converge on the same day, so you will have to hold on to it till trade comes to a logical conclusion.

  102. Akshat says:

    How do we calculate probability of mean reversion from density curve value?

    • Karthik Rangappa says:

      The density curve itself gives you the probability based in the principles of normal distribution right?

  103. Vidhya says:

    In Zerodha do we get two stocks standard deviation chart ? Will be available to watch any screeners showing pair above 3 or 2.5 SDeviation

  104. darryl says:

    hello karthik,

    i have read almost all of the modules that are here on varsity, and i am so very much impressed with how much simplicity and patience you created all this content. I had a fair understanding of all these concepts apart from pair trading module, but how you have presented the content has given me more insight on these concepts. Options Strategy module and the explanation of greeks is very good, and i must say the best i have ever come across on any free plateform.
    Please keep up the good work.

  105. Savan says:

    The above table which has heading DENSITY CURVE VALUE | HOW MANY STANDARD DEVIATION AWAY | PROBABILITY OF REVERTING TO MEAN is constant or it changes according to values..??

    And Can you explain how these values are calculated ??

    Thank you

  106. Savan says:

    Thank you sir for your response..

    So the values are true/constant for any pair of stocks ??

  107. manish surve says:

    hello karthik
    i m successfully tracking nifty/ banknifty.paper trade also successful.i just require ur advice when placing actual order on kite how to place both orders i.e for nifty and bank nifty at same time.both orders will be market price orders with stoploss .but how to execute both orders at same time on kite?plzz guide.

  108. manish surve says:

    thank u .

  109. Ayush Garg says:

    Hi Karthik ,

    While shorting the Axis/Icici pair future rollover is done . But I don’t know how rollover is done.

    • Karthik Rangappa says:

      Rollover is nothing but initiating the same position in the same quantity in the next month’s contract and closing out this month’s contract.

  110. Ayush Garg says:

    Hi Karthik

    Make sure your data is clean – adjusted for splits, bonuses, and any other corporate actions

    How to check and do this ?

    • Karthik Rangappa says:

      Whenever there is bonus or split, there should not be a big sudden change in stock prices. It should be cleaned up and adjusted historically.

  111. Mihir says:

    Have a question on the Target/Stoploss table mentioned above –

    While having a short position, we have kept the target of density curve at (+)2 SD. Correspondingly, for a long position why the target is 0.25 which is way towards the mean and away from (-)2 SD. Is there a particular rationale to it? Why it is not 0.025?

  112. Mihir says:

    I saw the earlier comments related to this query. AP had raised about the symmetry of target and stop loss but I don’t see a definite answer to it. If you can comment on this, Thanks.

  113. Mihir says:

    I will just layout how I am thinking for long position. Maybe I am wrong.

    For long, SD and density curve values are –
    – 1 SD – 0.16
    – 2 SD – 0.025
    – 3 SD – 0.003

    The target mentioned in the table is 0.25 which will be reached past the -1 SD and towards mean. Am I correctly thinking?

  114. Mihir says:

    Yes, I will jump onto the second method.

  115. Abhay says:

    Sir, is the close price in Zerodha candlestick chart the adjusted close price?

  116. puran bisht says:

    Hi Sir,

    It was a great learning.

    I have few questions and I hope it still reaches you after so long.

    1. What is the success ration of correlation pair trading.

    2. What is the need to calculate density curve if we have already calculated the standard deviation values of ratio {-1, -2, -3, mean & 1, 2, 3} {you have calculated them in chapter 5 PTM 1, C 3, Pre Trade Set Up} so just by given value of ratio we can make out the level of standard deviation it is in and can take the trade accordingly.

    Thanks for your reply in advance.

    • Karthik Rangappa says:

      1) The success ratio depends on the pairs. For a few pairs, it works really well, like 4 of 5 trades work
      2) This is the density curve is another way of representation. Works on the difference between the two stock prices.

  117. Kamal says:

    Hi Sir, can this DC Probability table you provided above be used for any pair or just this example ? Just curious to know how to calculate those values. ( I assume distribution from 0-1 with mean = 0.5)

  118. TUSHAR SAWANT says:

    Sir, If pair trade is tradable with stocks too,then what will be the Quantity ? Is there any particular ratio for required quantity or what?

  119. TUSHAR SAWANT says:

    Got it Sir ! I had asked this too early before going through second method on PT.
    Thank you ,again!

  120. Sagar says:

    Hi Kartik sir,
    What will be the stop loss in case it does not comes to its mean for longer time.

    • Karthik Rangappa says:

      You can hold it for as long as the SL is not triggered, provided the M2M situation does not go against you.

  121. Anand Yesu says:

    Hi Karthik,

    Thanks for giving us a detailed explanation. If one were to backtest, how to correlate dates from the data sheet. Please help.

  122. Avi says:

    Sir instead calculating data for All pairs can we just calculate for Ratio,The main thing is we must know Mean,Sd for Ratio to calculate density curve and how much historical data we must take. I took Historical data of past 2 years of same Axis And ICICI till that is yesterday and how to update from now onwards and how to backtest

    • Karthik Rangappa says:

      Update as in you will have to follow the process described in the chapter. Unfortunately, it is hard to backtest this without programing it. I’m not sure how that can be done.

  123. Avi says:

    https://drive.google.com/file/d/1JLvyHaYaTPknXZloAuRQmHPQPMt3q2Ew/view?usp=drivesdk
    Have tried this mark whistlers method on bpcl and hpcl,as I said just done with ratio not calculated spread and differential. I’ve shared the link and I’ve marked one pair trade I found🙏

  124. Avi says:

    Sir I’ve shared a file
    Please go through it once,just a glance I’ve not calculated spread and differential but I found some trades have marked that too
    Thank you😊

  125. Avi says:

    In correlation method how to decide which stock to decide stock A and which as stock B
    If I need to take HUL and Britannia who to decide which is first stock and second
    Is there is rationle behind this are,can we take randomly

    • Karthik Rangappa says:

      The correlation between Stock A vs Stock B is the same as the correlation between Stock B and A. So it does not matter.

  126. Avi says:

    SIr even without using programming for backtesting I can know its working when ratio reverts back to mean.

  127. Mitesh says:

    Dude

    I think the long stop loss that you said 0.003 or higher means actually means 0.003 or lower and not higher.

    Also tell me if I enter the trade at 0.0275 and it keeps hitting 0.0250 0.0225 0.0220 etc then what happens. I mean it costs a lot of money sometimes

    • Karthik Rangappa says:

      Ah yes, inadvertent typo 🙂

      About the movement, yes, that’s the nature of the trade, cant really help it.

  128. Avi says:

    Date Stock Trade Lot Size Sq off date Sq off Price P&L
    22-Feb-21 SBILIFE Buy @ 849 750 6-Apr-21 897 147 110250
    22-Feb-21 HDFCLIFE Sell @ 690 1100 6-Apr-21 697 7 7700
    Total P&L 117950
    Sir just backtesting,Sir its been two months you can see when I initiated pair trade,I just closed trade yesterday,but my target being -1 SD is still not achieved can one close trade when we are in good profits early or wait till target to reach which is taking months
    2] Sir when we initiate trade at -2 SD keeping -3 SD as SL And -1 as target there is no good RRR ratio here, it never goes to -3 Sd so one can initiate trade there
    3] Can both stocks give profits which you can see in my case

    • Karthik Rangappa says:

      1) This is quite common, pairs neither converge or diverge, but slowly eat M2M, hence it may not be a bad idea to have a time-based SL on these trade. For example – Close the trade in 5 days, regardless of P&L. Of course, comes with some limitations, you got to weigh its pros and cons
      2) Yup
      3) Possible, but very rarely.

  129. Avi says:

    Pardon me Sir,Previous comment calculations are bit wrong,the profit comes to 28300 if I sqr off position without Target is being achieved.

  130. Bharath says:

    Sir took 2 years historical data done with the process,from now onwards I just need to update every week to find pair opportunity
    My question is I just need to add for ex one week data to 2 years data and calculate mean,medain,sd OR
    just 2 years OR
    keep on adding data to existing 2 years for this I need to randomly change every data

    • Karthik Rangappa says:

      Sorry, I dint fully understand your query, but from what I gather, yes, once you have set the data, then you need to just update it.

  131. Bharath says:

    Just updating for 2 year data or now I should take exact new 2 years from now

  132. Sarthak Singhal says:

    Hi sir, can you please provide a list of pair widely used so i can do my calculations on that and see the results.

    • Karthik Rangappa says:

      You can start with any two companies that are similar like ICIC – HDFC, TCS – INFY, HCL-Mindtree, BPCL – HPCL etc

  133. Sarthak Singhal says:

    SIR, in my one pair their closing price correlation is 0.9 but return percent correlation is 0.02. How is that possible and what to do in that case. And how to know if they are positively correlated or negatively .

  134. Ravi Saini says:

    Hi ….What about the pair which are negatively corelated ? SHould we apply the same technique of long and short pair trades mentioned in this chapter?

  135. Sarthak Singhal says:

    SIR, can pairs be made like a private bank and public bank if they have a correlation around 0.7?

  136. Amit Patnaik says:

    Hey Karthik, highlighting a typo here for edit.

    ‘Hence we sell Axis Bank (numerator) and sell **buy** ICICI Bank (denominator)’

  137. Sarthak Singhal says:

    Sir , can you please provide around 20 pairs which are traded the most to look on daily basis. It would help me a lot.
    Thank you.

  138. Chandu says:

    Initially I took 400 days closing price there after kept on updating 14 days once now excel sheet have more than 600 days CP and now I need to update Ratio with Mean ,SD
    Now Data took To calculate Mean And SD is 600 it is huge
    Is it OK? SIR
    Thank you!

  139. Avi says:

    In 2018 tcs has issued bonus so I ignored 2018 datsa and took from 2019
    Is this Ok
    For pair
    Infy vs tcs

  140. Chandu says:

    Once we get a trade opportunity
    Should we update mean and sd are go with old values

    2) With updating daily ratio and density curve
    Should we also change mean and sd regularly
    Or leave it untouched for say I took starting 2 year Sd and mean

  141. Chandu says:

    Initially we take 200 day data and followed steps mentioned by you,Sir you should have given a touch on updating
    daily.
    Why I’m saying is because I got an opportunity on 26 april on HDFC vs ICICI bank near -2 sd,I kept my target as -1 its still around -2.
    The it was 262 days data which I calculated sd,mean….
    for 262 days -1 (target) came to 2.60
    once trade initiated I kept on updating daily , even mean,sd (now 281 day data) but now -1 comes 2.54
    which I need to take into consideration
    2.60 or 2.54
    Thank you!

    • Karthik Rangappa says:

      Very hard to comment on this unless you are in the trade. I’d go with 2.6 if my capital would permit.

  142. Kishan says:

    Hi Karthik thanks for Interesting Module Trading System..After reading whole module i felt this should be go on forever!!
    Btw I had one doubt
    In first method its clear which stock is cheaper and which one is dear from ratio.can we buy call options for cheaper one and buy put options for dearer one.It will drastically reduce margine requirements.
    Thanks in advance…

  143. Kishan says:

    And people who are finding difficulties in finding price of stock in exel format here is trick
    1.Use google sheet
    it allows to use Googlefinance function it update delayed data about 20 min but its ok. plenty of documentation avaliable on google search
    2. To find stock symbol google stock price and frim google finace copy “NSE:SBIN”(For example SBI).REmove space between it.
    This will remove hurdles of downloding NSE bhavcopy for each stock.just copy paste and update symbol..
    Happy Trading..

  144. rohit says:

    As explained above, in 2nd trade, Axis bank was squared off @ 571 on 8th Sept,16, But the price of Axis bank was 629.3 on 8th Sept,16 as per the excel sheet, so this would be a loss on Axis Bank of -55.3 (574-629.3) *1200 = -66360

    Net P/L = 85330-66360= 18970 Profit.

  145. JOSHIN MC says:

    On 8th september 2016, the excel sheet shows price of axis bank as 629.35 instead of 571, so in a short trade it will be a loss

  146. Nisha Patel says:

    Hello Sir,

    W.R.T. shared Short Trade setup and shared excel sheet, needs to be cross checked as Axis Bank Sq Off Price: DT: 08/09/2016 @ 629.35 thus
    P&L= -55.25 * 1200 = -151937.5, which resulted into Total P&L= -66687.5
    Ratio Change: 2.340 TO 2.277
    Density Curve (Ratio) Change: 0.990631565 TO 0.979182556
    Trade Setup Period: 9-Aug-16 TO 8-Sep-16 i.e. 30 DAYS – Spread between two months. (Physical Settlement Obligation)

    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/-

    Kindly suggest if I have any misunderstanding in calculation and appraise on Physical Settlement obligation post expiry currently w.r.t. PAIR TRADE SETUP.

    Thanks,
    Nisha Patel

  147. Nisha Patel says:

    Hello Sir,

    Below Pair Trading Opportunity identified Pair HDFC & ICICI Bank and probably still continuing.

    Date Spread Differential Ratio Density Curve (Ratio)
    4-Aug-21 31.750 750.650 2.050 0.135276437
    5-Aug-21 12.600 782.400 2.114 0.158836056
    6-Aug-21 6.050 795.000 2.140 0.169112861
    9-Aug-21 5.700 801.050 2.140 0.169185014
    10-Aug-21 -5.350 806.750 2.151 0.173834053
    11-Aug-21 -1.350 801.400 2.156 0.175700696
    12-Aug-21 21.350 800.050 2.141 0.169597856
    13-Aug-21 6.550 821.400 2.165 0.179880447
    16-Aug-21 -14.500 827.950 2.178 0.185396007
    17-Aug-21 11.250 813.450 2.160 0.177619626
    18-Aug-21 0.000 824.700 2.198 0.194091486

    Standard Deviation
    Spread Differential Ratio
    3 152.980 1499.967 4.588
    2 101.322 1270.537 3.970
    1 49.664 1041.107 3.351
    Mean -1.994 811.677 2.732
    -1 -53.652 582.246 2.113
    -2 -105.310 352.816 1.495
    -3 -156.968 123.386 0.876

    LONG – HDFC BUY 4-Aug-21 @ 1465.3 BUY 18-Aug-21 @ 1513 SELL; Point = 47.7*550 (LOT SIZE) = 26.2 K PROFIT
    SHORT – ICICI BANK 4-Aug-21 @ 714.65 SELL 18-Aug-21 @ 688.3 BUY; Point = 26.35*1375 (LOT SIZE) = 36.2 K PROFIT
    TOTAL P&L= 40.3 K
    TOTAL PERIOD= 13 DAYS

    Hope I have identified correctly, seeking your inputs.

    Thanks,
    Nisha Patel

    • Karthik Rangappa says:

      Nisha, thanks for posting this. It will be very difficult for me to validate the trade, especially when its posted here 🙂

  148. Nisha Patel says:

    Hello Sir,

    Kindly guide for calculation w.r.t. corporate actions such as bonus/splits.
    Not aware about HDFC BANK Corporate action, but there Major Price Difference as below:

    HDFC BANK
    DT:18-Sep-19 CLOSE PRICE: 2187.75
    DT:19-Sep-19 CLOSE PRICE:1101.05
    PRICE CHANGE: 1086.70
    Due to this major change in close price, derived values for Ratio and its change, Mean, STD Deviation etc. seems to be inaccurate.

    Struggling for onwards (DT:19-Sep-19) calculation post probable HDFC BANK stock split.

    Kindly assist.

    Thanks,
    Nisha Patel

    • Karthik Rangappa says:

      Nisha, whenever such a change occurs, you need to replace the entire data series which is adjusted to reflect the corporate action. Usually, this is referred to as the clean data. You get this from any decent data vendor.

  149. Sarthak Agrawal says:

    Sir it was truly great to know the basics of pair trade through this chapter…But I would like to point to a little change in the Digging the desity curve Part….Instead of -3 SD for a value of 0.99 shouldn’t it be +3 SD?

  150. Shiv says:

    Sir in statistics the 68-95-99.7% data rule only work when the data is distributed normally, right?

    We know that stock returns are normally distributed but are ratios also distributed normally?

  151. Dhiraj Tandel says:

    Can we apply pair trading strategy in Options trading?

    To what scale this strategy will work?

  152. Dhiraj Tandel says:

    So, inorder to execute this strategy, we need 8 to 10L to invest?

    Can this strategy work for those who is willing to invest low capital? If yes, What is the initial capital required?

  153. Dhananjay says:

    Those who likes mathematics, I don’t think they will see charts anymore after learning this 😅

    Amazing content sir!

  154. Dhananjay says:

    I have few doubts at this point

    1) When density curve touches 0.997 level we can say that there is only 0.003% chance of getting prices beyond that but does that really mean prices will retrace back to mean or 2SD (0.995 level)? Can prices get in consolidation and hit target(or SL) after long time?

    2) I ran same ICICI and Axis bank’s calculation today as per new data points. From density curve I found 1 opportunity to go short. Here, I sold ICICI and Bought Axis (I actually calculated ratio that way so). Here as expected, axis bank went up making me profit but ICICI bank also went up giving me loss. But trade was in net profit. My question is, can it ever happen that both stocks moves opposite to my expectation (derived from density curve) and give me loss?

    • Karthik Rangappa says:

      1) Yes, but remember this is only a probability, not a guarantee.
      2) Yes, this can happen as well.

  155. Dhananjay says:

    Thank you so much and I really liked the content you are providing!

  156. Dhananjay says:

    “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.”

    Here which mean you are referring to? Mean of Ratio or mean of Density curve?

  157. Dhananjay says:

    I will have to track density curve on daily basis to keep track of trend in it. So when I add new closing prices and variable(ratio in our case), number of data points also increases day by day. So in some time in future there will be more data points than we normally use. Should I consider deleting old data points (closing prices and related data) and keep fix number of data points of around 500 data points every time?

  158. Dhananjay says:

    Also I found only one trade trigger from March 2020 till date on Axis and ICICI Bank 😅
    Really need to track multiple pairs!

  159. Dhananjay says:

    Is there any way I can make all this density curve, ratio, closing prices and all real time?

  160. Dhananjay says:

    Okay! Gonna make it 😀

  161. Dhananjay says:

    I have never used Streak and have no idea about what I can do with it. Can you please tell me is it possible to deploy all these things in Streak?

  162. Chetan says:

    Hello sir,
    Beautifully explained another master piece. So, after letting everything discussed above i have couple of doubts left with me. Mind sparing another couple of minute for me?
    1. What exactly are we taking about Futures, Equity or Options
    2. If options what are the effects of Greeks and how to select contract expiry(for futures too)
    3. The ratio between Axis and ICICI was 2.3 so for every 1 lot of Axis shorted we need go long on 2 lots of ICICI , right?

  163. Chetan says:

    Sir my fault for not clarifying the question properly .. In(1) I wanted to ask that when you said Buy or sell Stock A … what are we supposed to buy or sell will we buy the stock (equity) or we go long or short on the derivatives part? or maybe any of them?

    I’m too hocked on varsity thus i’ve been reading a lot and completed all the previous modules Each one of them is beautifully explained.

    • Karthik Rangappa says:

      Chetan, so when you pair trade, the best bet is to trade only in the futures. But, that won’t workout well all the time, since getting a perfectly balanced trade is not possible all the time. So the short side of the trade is usually futures and on the long side is Futures + stock. Really depends on case to case basis.

  164. BALBIR SINGH says:

    Short Between 0.975& 0.997 Between 2nd & 3rd 0.975 or lower 0.997 or higher

    Sir, for short entry, as per above write-up it should between 0.975-0.997 and how the target can be 0.975. Pl. correct me and guide what should be target in case of short entry.

    • Karthik Rangappa says:

      We are shorting the spread with an expectation that the spread will drop or converge back to the mean value.Hence short at around 0.997 and hold to 0.975.

  165. Dhananjay says:

    How much historical data I should be using for calculations of the statistics? Like here you used 2 years historical data. Is that enough? Or is that too much? How much?

  166. Tarun says:

    hi Karthik

    Can we use pair trading system to trade in the cash market for taking long trades for swing trading. Say when we get a buy signal for one stock and a sell signal for another stock – can enter into the buy signal to take the benefit of price misalignment and exit the trade when our trading system asks us to exit. Would you suggest that to someone who does not have high capital for managing mark to markets.

  167. MEHHUL says:

    HI KARITK SIR
    I know i am too late for this comment idk if you’ll see this or nut but this pair trading technique works very well i have backtested it many times also i have made a software application in one go for this pair trading its very helpful if you want to see it you can contact me on my mail
    Thank you for this amazing module

    • Karthik Rangappa says:

      Mehhul, I do check the comments everyday, so yeah, its not too late 🙂

      As long as the s/w works and you get good results, its good for you. I hope the profits continue to roll 🙂

  168. Anirban Basak says:

    Sir,

    For a long pair trade, you have mentioned the following:

    Density curve: Between 0.025 & 0.003
    Target: 0.25 & lower

    However, think the above (Target: 0.25 & lower) as Typo error, should it be the following instead?

    Density curve: Between 0.025 & 0.003
    Target: 0.025 & higher

    Please help to get clarified here.

  169. Anirban Basak says:

    Sir,

    Till you recheck, could you kindly help to understand if I could move with the below for long pair trade?

    Density curve: Between 0.025 & 0.003
    Target: 0.025 & higher

    • Karthik Rangappa says:

      Thats correct, Anirban, Btw, these things keep changing for every pair. Keep these as your guiding notes, and change as per the pair you are dealing with.

  170. satish semwal says:

    sir , can we use ST deviation in future swing trading as well ?

  171. Anirban Basak says:

    Sir,

    The below is with regards to the Mark Whistler’s model:

    (i) Can we go with 2 years pair data? If yes, then should we remove the most earliest data everyday and insert new data. Is yes, then that will fetch a new ratio which will then change the average and SD of the ratio and invariably the Density curve. Please guide if I am correct predicting to analyze for each day.

    • Karthik Rangappa says:

      Yes, if you are going ahead with 2 year’s then you will have to flush out the oldest data and include the newest on a daily basis. In that way, your data is updated on a rolling basis.

  172. Anirban Basak says:

    Sir,

    For short trade, as you have written that trigger is between 0.975-0.997 (between +2SD & +3SD) density curve value. You have also written that target will be 0.975 or lower (that is implying below +2SD towards the mean)

    Again, for long on pair trade, you have mentioned that trigger is between 0.025-0.003 (between -2SD & -3SD)density curve value. You have also written that target will be 0.25 or lower. Will it be 0.025 or higher like the one for short trade? Is it a typo error? Or I am missing somewhere? 0.025 or higher will mean similarly as short trade i.e, above -2SD towards the mean.

    Please help to understand here.

    • Karthik Rangappa says:

      The logic is that when you short, you short at higher end of the density curve, with an expectation that the density curve will collapse back to mean levels. Likewise in a long trade, you go long at the lower end of density curve with an expectation that the density curve will converge to mean levels.

      Given this, the explanation seems correct no? or am’I missing something?

  173. Anirban Basak says:

    Sir,

    Thanks.

    I exactly feel the same way as yours regarding the density curve values for ratio. However-

    For a long pair trade, you have mentioned the following:

    Density curve: Between 0.025 & 0.003
    Target: 0.25 & lower

    However, think the above (Target: 0.25 & lower) as Typo error, should it be the following instead?

    Density curve: Between 0.025 & 0.003
    Target: 0.025 & higher instead of 0.25 & lower

    Please help here to get understood.

    • Karthik Rangappa says:

      So you initiate the trade when the density curve is low i.e. 0.025 or lower and wait for the target. It could be 0.25 (much higher than 0.025) or higher.

  174. Anirban Basak says:

    Sir,

    To pair trade through Mark Whistler’s, we know that daily excel update is required at EOD. Now, suppose we found ater excel update after 3:30 pm that a trading opportunity is there. So, how do we need to act to trade? Should we buy & sell on the following day on market open? Or additionally we have to ensure that the following day price should matches around the corresponding price which will be suggested for the pairs of the Density curve? Please advise.

    • Karthik Rangappa says:

      So you’d know that there is EOD trigger to long or short on a pair trade, you will also know the price points at which this is triggered. You need to ensure that the next day opening the prices are around the previous day’s close and then initiate the trade.

  175. Anirban Basak says:

    Sir,

    To pair trade, we require to move with clean data. Now, suppose today is 30.10.23 and a particular organization announces a stock split on today. Now, suppose I have to work after 3:30 pm today to see if any trading opportunity arrives. While for the other days, I would be required to erase the oldest data and populate with today’s data. In days of split/bonus issue, do I need to erase the whole excel data of the concerned stock for all the previous days (say 2 years) and populate for fresh data of the adjusted stock for the previous 2 years? Please suggest.

  176. Anirban Basak says:

    Sir,
    You suggested to avoid pairs where there is a corporate action. Now, there are many reputed pairs like TCS & Infy itself where there used to happen corporate actions every 5-7 years. So, should we altogether avoid these pairs or we should avoid trading pairs on the day of the corporate action. Kindly suggest as I am confused. Also, if corporate action happens, how should we use the already populated excel. Should we remove the entire excel data and populate with clean data.

    Please help to understand. Or should we completely ignore pairs of such type.

    • Karthik Rangappa says:

      Ah, sorry I should have given clarity. Avoid, pair trading in stocks which are going through a corporate action. What I mean by this is to avoid trading on the day, maybe a day before and after the corporate action. You can initiate the trade anytime else there is a trading signal.

  177. Anirban Basak says:

    Sir,

    Thanks. Meanwhile, after a corporate action, should we have to populate the excel with previous data wholly removed and with new clean data?

  178. Anirban Basak says:

    Sir,

    After a corporate action, does zerodha show the graph with clean data on the same day? I am aksing since, I use the zerodha data to figure out opportunity.

  179. Vardhan says:

    With reference to provide sample excel sheet where total series 496 days on daily closing. On #496 Bars/Candle/Days – derived Mean, Stdv, Density Curve etc..
    What is ideal Bars (Candle) required for day TF and in case of Intraday TF ?

  180. Anubhav Kabra says:

    Hi Karthik,

    Firstly, a HUGE THANK YOU for the stupendous effort put in to develop Varsity. This is PURE GOLD, for generations to come.

    I had a question on this particular example of Axis Bank and ICICI Bank.
    What about the low correlation on all three variables of Spread, Differential and Ratio? Should that not suggest that the 2 stocks are poorly correlated and hence, not a good Pair Trading candidates?

    Essentially, for any pair, should there not be a minimum correlation threshold before proceeding with further analysis?

  181. Anubhav Kabra says:

    Correction:

    “…low correlation on all three variables of Price Close, % Return and Absolute Change…”

  182. Sukrit Bera says:

    Hello Karthik!
    First of all, thank you for the awesome modules. They are really lucid, and extremely helpful for beginners. I had a few questions regarding this chapter as a whole. Firstly, if the model gives me a trigger based on the ratio variable, should there be a similar trigger from the spread or differential variables as well? Or should I not be concerned if the ratio density curve gives me a value of 0.95 (a trigger for a short), while the spread gives me a value of 0.03 (a definite long trigger) for the same setup and differential gives me a value of 0.47 (no particular trigger)? I’m using the NIFTY and SENSEX, because they have very high correlation since they’re benchmark indices. Secondly, in case of NIFTY and SENSEX, there is a high correlation for both closing prices and daily log returns (more than 0.99 both) which is understandable because they’re both benchmarks, but in case of SBI and Bank of Baroda, the closing price correlation is 0.88 while the daily log return correlation is 0.76. I chose these two stocks because SBI and BOB are the largest and second largest PSU banks respectively. Which correlation type should I use here?

    • Karthik Rangappa says:

      Thanks Sukrit.

      1) The number of triggers – either just ratio, just spread, or combination are all optimizable. One thing that the traders do is that they factor in these things, and back-test which is giving them the best output. Also, what combination works for Pair 1 may not work for Pair 2. So that should give you a perspective of the level on backtesting and optimization.

      2) I’d suggest the returns correlation.

Post a comment