A Guide to Trading Systems

Lesson -> The Density Curve - PTM1, C4

6.1 - A quick revision

A quick summary is a good idea at this point. This is because it is important to make sure we are all on the right page. To ensure that we stay on the right track, I strongly suggest you go through the recap. To make sure we don't wander off-track, I will keep this brief recap as a pointwise summary.

  • If they have similar business backgrounds, two companies can be compared
  • The business background is important because it influences the day-to-day running of the company.
  • It is reasonable to assume that share prices will move in a similar way if two companies have similar business histories
  • A tight correlation is when two companies with similar stock prices move together (and their daily returns), and they have a close relationship
  • Sometimes, a local event can alter the direction of the stock price movement of one company. This creates a pair trading opportunity
  • Any of the three variables spread, differential or ratio can be used to estimate the relationship between stock prices for the two companies.
  • We expect the variables to be normal distributed. Therefore, we calculate the standard deviation and basic descriptive statistics like the mean, median, mode.
  • We also have the standard deviation table (SD) as a ready reckoner. This extends up to the 3 rdSD, on either side.
  • Remember that we are currently discussing two types of pair trading. Let's start with Paul Whistler’s Pair Trading technique. Then, I'll discuss a slightly more complex version of Pair Trading.

This brings us to the current stage. We will now discuss the density curve, and the trigger for pair trade in this chapter.

6.2 -How to select variable

We are at a point where we must stick to one variable amongst Ratio, Differential and Spread. You may be asking why only one or not all of these variables are important.

This is so that we don't get confused by conflicting signals and stick to a system. To show that there are three options, I have included all three variables. You, the trader, can choose which variable you feel most comfortable with. Personally, I prefer the ratio to the spread or differential. The ratio captures the stock market valuation since it takes into account the current stock price. The ratio gives us an instant indication of the stock's market value.

If Stock 1 has a price of 190, and Stock 2 is 80 then the ratio of stock 1 to 2 is -.

190/80

= 2.375

This means that for every 1 share in Stock 1, 2.375 shares in Stock 2 must be traded. We'll get into the details later. For now, we hope you get the gist.

Of course, you can choose any variable, spread, differential or ratio. For the sake of discussion, I will use the ratio.

6.3 - What is The trade trigger?

The name of the pair suggests that it consists of two stocks. We have not yet defined how to purchase or sell a pair. Later we will do that in the chapter. Assume for now that you can purchase or sell a pair the same way as you can sell one stock.

As you might have guessed, buying or selling a pair of pairs is dependent upon the variable you track. This variable could be the spread or differential or the ratio. We will be using the Ratio for this discussion.

It's simple: Stock prices fluctuate every day. Therefore, the ratio of the two changes each day. Most days the daily change of the ratio is within the range. There could be days where the daily change exceeds the expected range. These are the days that a pair trading opportunity is available.

Take a look at this chart (IMAGE 1)
 

Two things are obvious from casual eyeballing:

  1. The ratio chart hovers between 1.8 and 2. This is probably because the ratio's average is about this price. This has been highlighted with a green line. You might want to check the average value of the ratio that we calculated in earlier chapters.
  2. Most days, the ratio hovers between the mean and the extremes of the mean.

This is what I want to ask you to do. This is the tipping point for Pair trading. If you understand what we have talked up, the rest of Pair trading will be easy.

The ratio is itself a variable that is calculated by dividing stock 1 and stock 2 Because stock prices fluctuate every day, the ratio changes daily. The chart showing the daily changes in the ratio will show that it has an average (mean), and that the ratio trades between the mean and extremes of this value. There is a good chance that the ratio will return to its mean in the coming days, regardless of what it is right now (i.e. above or below the average). Notice that I used the word "great chance" here. This is a way to say that it should be possible to calculate the likelihood of the ratio returning to the mean.

This phenomenon is also known as "Mean reversion" or reversion toward mean.

In red, I have highlighted two points on the chart where the ratio is off the mean. The first circle to the left signifies a point at which the ratio is higher than the average value. The 2 and 3 circles to the left indicate a point at which the ratio is lower than the mean. In both cases, the ratio eventually returned to its mean.

If you think about it another way, we can now form an opinion on the direction that the ratio will likely move. The ratio is most likely to return to its mean if it moves above the average circle. You can also shorten the ratio at its highest point and then buy it back to the mean. The second circle indicates an opportunity to buy the ratio with the expectation that it will return to its average value.

The ratio can be thought of as a stock, or futures. We can place bets on its directional movement because it is predictable.

I trust you get the point.

Trades can be initiated by the ratio's value relative to the mean. If the ratio is 0,

  • Above the mean, it is expected that the ratio will return to the mean. Therefore, the ratio will be shorter
  • Below the mean, it is expected that the ratio will return to the mean and thus go long.

Alright - so far so good. But, here are a few questions.

  1. Do you think that trading opportunities are always available if the ratio is always higher or lower than the mean value?
  2. There were multiple points at which the ratio appeared to have topped out. How do we determine the exact moment when the trade should be initiated?

These questions can be answered by something called the "Density Curve". Let's find out how it works.

6.3 - Understanding The Density Curve

Take a look at this chart -


(IMAGE 2
 

The chart shows 4 points. At all four points, the ratio traded above the mean. Let's suppose you were looking at the chart around the mark of the first circle. Would you trade if the ratio is higher than the mean? The same question can be asked each time the ratio trades above or below the mean.

This would be a fantastic idea, I'm sure. It is important to carefully monitor the ratio and only initiate trades when there is a high chance of mean reversion. We need to make sure that the ratio is moving down to the mean value as soon as possible.


 

This is a lot like a tiger hunting down prey in ambush. The tiger won't jump on the prey just because it is open to attack. Only if it is certain that it will be killed, will it attack.

How can we wait to get our chance at the kill and stay in the ambush?

We can find refuge in the old Normal distribution and its many properties. I hope you're familiar with normal distribution and its properties. This is a brief summary. I recommend you to read the entire theory. I have discussed this in Varsity throughout various chapters.

  • You can see 68% of the data within the 1 st normal deviation (SD).
  • The 2 and standard deviations can be used to observe 95% of data
  • 99.7% can be observed within the 3 rd normal deviation

This is how it looks in relation to the ratio.

  • The standard deviation value is the ratio's average deviation, regardless of its position in relation to the mean. It could be, for example, just a few points off the mean. This could translate into 0.5 standard deviations below mean
  • If the ratio is greater than the 2 nd average deviation, then it has a 95% chance to return to its mean.
  • The ratio that is less than the 3 rd standard deviation has a 0.3% chance to drift higher or looser. It also has a 99.7% chance to return to the mean

We can calculate the probability of the ratio returning to the mean for each SD. This allows us to filter out trade opportunities and only initiate trades at points that have high chances of success.

The interesting thing about this is that the trigger to initiate trades is not only based on the ratio's current value, but also on its standard deviation. It makes sense to track the daily standard deviation rather than the actual ratio.

You can track the 'Density Curve’ of the ratio to achieve this. The density curve is a value that lies between 0 to 1. The density curve is a non-negative value that lies anywhere between 0 and 1.

Excel makes it easy to calculate the density curve. This is how it works. Take a look at this image.
(IMAGE 3).
 

This can be done using the built-in excel function Norm.dist. This function needs 4 inputs

  • X is the daily ratio value
  • Mean - This is the average or mean value of the ratio
  • Standard Deviation – This is the standard deviation of a ratio
  • Cumulative – You must select true or false. The default value is chosen as true.

Here is the table I created after I calculated the density curve value of all variables.


(IMAGE 4).
We could probably end this chapter here. We will be discussing in the next chapter how the density curve can be used to trigger both long and short pair trading.
 

keypoints

  • Ratio is a more flexible variable because it captures all the valuation elements of the stock
  • The ratio trades above or below its average value.
  • It is a simple idea that the ratio will tend to return to the mean if it diverges from the mean.
  • We can calculate the likelihood of the ratio reverting to its mean at every point where it deviates
  • Normal distribution can be used to measure the above point
  • Density curves are a non-negative value that can vary between 0 to 1. You can easily calculate this using MS Excel's in-built function.