A Guide to Trading Systems

Lesson -> The Pair Trade - PTM1, C5

7.1 - Quick revision

The previous chapter was closed with a note about the Density curve. We discussed how its value helps us identify pair trading opportunities. This chapter will help you identify and initiate a trade. It also teaches you other dynamics that are associated with a pair trade.

As a reminder, the pair trading techniques that we have covered (i.e. chapters 1 through 7) are from Mark Whistler's book 'Trading Pair'. This technique has the best part - its simplicity. The part that I don't like about it is also its simplicity. I have improved my technique for pair trading over time, which I will discuss in the next chapter.

You may be wondering why we don't discuss the 2 and 3 methods directly. This is because the Mark Whistler method of pair trade provides a solid foundation that helps you understand the more complicated pair trading method. Let me now finish this chapter by introducing the next pair trading method.

Because I will be discussing this technique to pair trade, it is not possible to get into all the details of the trade setup. Instead, I will concentrate on the overall trade setup.

Let's get going.

7.2 - Turning over to the Density curve

We can identify trade opportunities by using the density curve as a trigger.Look at these two points-

  1. The time series data is what is used to calculate the density curve. In our case, it is the "ratio" time series. As you may recall from the previous chapter the main inputs for the calculation of the density curve are the ratio’s time series, ratio's average, and ratio's standard deviation.
  2. The density curve is a value that can range between 1 and 0. The density curve is a value that can be used to determine the likelihood of a ratio falling back to its mean.

While I realize that the 2 nd statement might be confusing to some readers, I suggest you keep this statement in your mind. As we move on, you will see what I mean.

Let's spend some time discussing the normal distribution. I am sure we have already discussed it multiple times, but please bear with me.

Time series data, such as the ratio, typically have an average or mean value. The ratio's average value is 1.87, which we calculated in the previous chapter. The ratio's value tends to be close to the mean value. If the ratio's value drifts from the mean, one can expect that the ratio will return to its mean value.

If the current ratio is 2.5, then one can expect that the ratio will fall over time to 1.87. And vice versa if it falls to 0.

Here's a question: If the ratio moves away from its mean (which is bound for happen every day), is there any way to quantify the likelihood that the ratio will return to the mean?

If the ratio value is 2.5, then we know that it will drop to a median of 1.87. But what about the likelihood of this happening? What percentage of it is 10%, 20%, or 90%?

The density curve is a useful tool. The density curve's value tells us how far the ratio has diverged from its mean in terms of standard deviation. If the value is expressed in terms of standard deviation, it is likely that it has a probability. This probability eventually helps us to set up trades.

Let me give you a quick example.

Take a look at the following data:

Latest ratio - 2.87

Ratio Mean - 1.87

Density curve – 0.92

This is how the data is interpreted: The 0.92 density value indicates that the most recent ratio 2.87 is slightly higher than the 2 normal deviation. There is a 95% likelihood that 2.87 will revert to its average value 1.87.

How did we get here? What tells us that this ratio of 2.87 is about the same as the 2 standard deviation? This is inferred by looking at the density curve value, i.e. 0.92

The standard deviation values are represented by the density curve value between 0 and 1. For example, -

  1. A density curve of 0.16 indicates that the equivalent value is at the -1 standard deviation lower than the mean
  2. Density curve value 0.84 indicates that the equivalent value is at the +1 standard deviation higher than the mean
  3. The density curve value 0.997 indicates that the equivalent value is at the 3 standard deviations higher than the mean

Once I have the standard deviation, I will also know the probability.

But how did I get to 0.16, 0.84 and 0.997? These are standard deviation values. I'll skip going into detail about standard deviation and instead present a table that you can use to quickly calculate -


If I look at the density curve value around 0.19, I can see that the ratio is approximately the -1 standard deviation. Therefore, the probability for the ratio to return to its mean is about 65%. If the density curve value is 0.999, then I know that the value is approximately the -3SD. Therefore, the probability for the ratio to return to the mean is about 99.7%

And so on.

7.3 - The first trade of pair

We are now very close to our first pair trade.Points to take care of-

  1. Divide Stock A by Stock B to calculate the ratio. In this example, Stock A represents Axis Bank while Stock B is ICICI Bank. So Ratio = Axis Bank / ICICI Bank
  2. Based on the stock prices at ICICI Bank and Axis Bank, the ratio value fluctuates daily.
  3. Daily calculations of the ratio and its density curve value must be done

Trading philosophy: Below -

  1. Stock prices are more likely to move together if two businesses operate in the same environment, such as Axis Bank or ICICI Bank.
  2. Stock prices will be affected by any change in the business environment.
  3. One company's stock price can be affected by a single incident. The ratio can deviate on such days
  4. These deviations are what we look for to identify trading opportunities.

A pair trader basically tracks the ratio and the corresponding density curve value. A pair trade occurs when the ratio and density curves have sufficiently deviated from the mean.

We now have to ask the obvious question: What is convincingly enough? Also, at what density curve value should we initiate trade?

This is a guideline for setting up a pair trade.
You want to start a trade, either long or short, when the ratio is between 3 _ rd standard variation and 2 _nd. Then square off the position if it falls below the 2 _ndstandard deviation. The closer the trade is to the mean, the greater your profit.

On 25 th October 2017, the density curve value for the was 0.05234 while the ratio value for the was 1.54. This long pair trade is decent. This trade does not fit the criteria for a long trade preview (the density curve must be between 0.0.025 and 0.003) but it is still the best value in our time series.

If the ratio is Stock A/Stock B, then it will be -

  1. You must buy stock A and sell stock B in order to make a long trade
  2. You must sell Stock A and buy Stock B in a short trade

The ratio has been defined as Axis / ICIC. Therefore, on 25 closing, one would –

  1. Axis Bank at Rs.473
  2. Sell ICICI Bank @305.7

Axis' lot size is 1200. Therefore, the contract value for Axis is 1200 * 473 = R.567,600/. The contract value for ICICI Bank is Rs.840675/- because the lot size is 2750

In order to be ideal, we should stay within the same Rupee value both long and short. This is sometimes called "Rupee neutrality", but I will skip it for now. When we move on to the next pair trading technique, we will expand the concept of Rupee Neutrality.

Once the trade is established, we must wait for the pair's move towards the mean. The ideal pair trade is one that you open near the 3 RD SD. Wait for the ratio to move towards the mean. However, this can take a while and could lead to a painful mark to market. If you don't have the funds to cover mark to market, it is important to close a pair trade quickly.

The ratio increased to 1.743 on 31 October 2017 and the corresponding density value was 0.26103. This is approximately the target density value.Any time the trade can be closed.

We sell Axis Bank @ 523, and buy back ICIC @ 300.1. These are the details for the P&L.

You will notice that the majority of the profits come from Axis Bank. This indicates that Axis Bank has deviated from its regular trading patterns.

It's not bad, huh?

Let's take a look at a brief trade right now.

The density curve published a value of 0.99063156 on 9 August 2016. This was close enough to start a short pair trade. In a short trade, Axis is sold and ICICI is bought.

It can be confusing to know which stock to buy or sell. The numerator is the dominant stock. If the pair trade requires you to go long, you should buy the numerator. The numerator can be shorted if the pair trade is too short. Regardless of what you do with numerator, opposite trades occur with denominator.

We sell Axis Bank (numerator), and ICICI Bank, (denominator).

Here are the details:

  • Short Axis @ 571
  • Buy ICICI @ 245.35
  • Ratio - 2.34
  • Corresponding Density Curve Value - 0.99063156

After the trade was initiated, the chance to close it occurred on the 8 th September (yes, the trade remained open for nearly a month). The details of the trade were:

  • Axis for 571
  • Sell ICICI @ 276.33
  • Ratio - 2.27
  • Corresponding Density Curve Value - 0.979182

Yes, it would have been possible to wait a little longer for the density curves to drop further. But, as I mentioned before, the pair trader must strike a delicate balance between mark to markets and time.

Below is the P&L for this trade.

The profit is mainly from ICICI which indicates that ICICI may have strayed from its original course.

Both trades were not included in the prescribed table that gives you guidelines for entering and exiting pair trades. As I mentioned, you can use the table to guide your knowledge and build it.

I encourage you to explore other opportunities within the Axis & ICICI Bank examples.

I hope that the P&L for pair trade will incentivize you enough to learn more. To ensure that you take in all of what we have discussed, I will deliberately stop. Let me conclude with a few points.

  1. All that we know so far is about 25% of the information I plan to share going forward
  2. The first seven chapters of this chapter will discuss a basic pair trading technique. This is primarily to lay the foundation.
  3. We don't adhere to any trade rules - targets, stop loss etc. You'll notice that I kept the information very generic.
  4. We haven't discussed neutrality between the two positions, but it is an important angle.
  5. We have yet to talk about the risks associated with pair trading
  6. Pair trading can be a risky business. You need to have enough funds to trade pairs, but it is well worth the effort.
  7. A given pair can only receive 2-3 signals per year. To find opportunities in the market, one must track multiple pairs.

I hope that I have sparked your interest in Pair Trading. I am eager to continue, and I hope you are as well!


  1. To initiate a pair trade, the density curve is a key trigger
  2. When the ratio falls to between 2 and 3, a pair trade can be initiated
  3. When the ratio is close to the mean, a pair trade is considered closed
  4. You must buy the numerator, and then sell the denominator in a long pair trade
  5. You must sell the numerator to buy the denominator in a short pair trade
  6. The majority of P&L is usually from stocks that have traded in a different way from the pair trade.
  7. While pair trades can be active for a longer period of time, the P&L makes it worth the wait.
  8. Pair trade is a money-guzzler.