A Guide to Trading Systems

Lesson -> How to Identify Trade?

12.1 -The Equation Trading

We have covered most of the basics about pair trading at this point. Now, we need to put the pieces together and make sense of all this information when opening a pair trade.

Let's go over the basics again. Although we've already covered this equation in the module, I would like you to consider it from a trader’s perspective. This equation can be traded in many ways. This is where I want to help you see the opportunities. This is where all the magic happens. 

What does this equation actually tell you? It all depends on your perspective on the equation. It is possible to look at it from either one of two perspectives.

  1. As a statistician
  2. Trader

Because we are dealing here with two stocks, the statistician would consider this an equation in which the stock price of a dependent Stock 'y' and an independent Stock Price 'x' is being explained. The 'price explanation process' also generates two variables, namely the slope (or beta), 'M', and the intercept c'.

In an ideal world, the stock market price of y would be equal to the Beta times plus the intercept.

We know this is false. There is always a variation to this equation that leads to the difference in the stock price of the stock and the expected stock price. This difference is sometimes called the'residual,' or the error term.

We can actually extend the equation above to include residuals, and the equation would look something like this.
y = M*x + c + ε

Where e represents either the error or residual of the equation. We are all familiar with the stationarity and significance of residuals, which gives the equation more dignity.

Okay, let's get to the fun part. How would a trader view this equation? Let me republish the equation.
y = M*x + c + ε

Let's break down this equation into smaller parts.

y = M*x  This basically means that the price for the dependent stock y is equal to the independent stock x, multiplied with the slope M. The slope is essentially the beta, and tells us how many stocks x would equal y.

Here is an example of the linear regression output for HDFC Bank (y), vs ICICI Bank x -
Here is a snapshot of the HDFC and ICICI prices.
(IMAGe 2

This means that the price for HDFC Bank is approximately equal to the price for ICICI times Beta. 1914 = 291 *7.61

Do not jump in to the math. I know it doesn't add up.

For a moment though, let's say that this equation is true. In other words, 7.61 shares of ICICI equals one share of HDFC. This is an important conclusion.

This means that if I were able to trade one HDFC share and 7.61 shares of ICIC shares, I would be essentially trading both long and short simultaneously. I have thus hedged a lot of directional risk. Remember the fundamental premise: We are considering these stocks because they are cointegrated.

Here's the equation:
y = M*x + c + ε

If this equation was true, then we would be able to go long or short on y or x and hedge the risk of this pair.

We now have the 2 nd portion of the equation, i.e c + e.

You know that C is the intercept. At this point, I would like you to recall the "Error Ratio" which we discussed in Chapter 10.

Error Ratio = The Standard Error Of Intercept / The Standard Error.

You may recall that we talked about the higher the error ratio, which is the best. Mathematically, this means that we are looking for pairs with a low intercept.

This is another important point to remember: We select the pairs such that the standard error for the intercept is low.

Remember that y is M*x + C + e. This equation is used to trade (or hedge every element). We are hedging Mx with y. Because we aren't trading or hedging, we want to minimize c and the intercept. We prefer a lower intercept, so the lower the better.

We are left with the residual, or the e.

The residual is a time series. This series has even been validated for its stationarity. Because the residual is a stationary series of time, normal distribution properties can be applied quite nicely. It means that I can only track the residuals and trigger trades when they reach the lower or upper standard deviation.

A trade is generally initiated when:

  1. When the residuals reach -2 standard deviation (-2SD), you can long on the pair (buy and sell y),
  2. When the residuals reach +2 standard deviation (+2SD), you can shorten the pair (sell one, buy the other).

The idea is to trade at the 2 nd standard deviation, and then hold it until the residual returns to the mean. Both trades can have a SL of 3SD. This chapter will discuss more.

This is a brief chapter. I won't clutter your head with additional information, though.

This equation should be understood from the trader's point of view and you need to know what you are actually trading. We are not trading the residuals. We are trading the residuals to hedge away the stock price for y by using x. The residual is traded and the intercept is maintained at a low level.

What makes the residual tradable. Because it is stationary, and its behavior therefore predictable. The next chapter will cover the practical aspects and details of pair trading.


  1. Actually, the main equation that we trade is the pair trading equation
  2. Each element of the equation has been carefully considered.
  3. The stock price of one stock is hedged with the stock prices of the other stocks. The beta of x is the number of stocks needed to hedge one stock of y
  4. We can ensure that the intercept remains low by looking at the error ratio. We are not trying to hedge the intercept. This is why it is important to keep it low.
  5. As it is stationary, the residual is what we trade and follows the normal distribution quite well.
  6. When residuals reach -2SD, a long trade can be initiated. A short trade can be initiated when residuals reach +2SD.
  7. We must go long on a pair if we want to be successful.
  8. We must be short on a pair if we want to go long on X and short on Y.
  9. We expect the residual to reach the mean when we trade a pair. So we wait until then.
  10. For both short and long trades, the SL can be set at 3SD.