Monday, April 14, 2008

Linear Regression Slopes With Standard Deviation Levels

A simple way to visually determine the trend of the market is to view the slope of the linear regression of data from any index or security. It is also helpful to have linear regressions over multiple time frames to determine the short-term trend versus the medium and longer term trend.

When adding standard deviation levels to these linear regressions, it shows a channel which can help determine when prices are extended with respect to the trend you are studying. These standard deviation levels are key to showing when a change in trend is happening. Once prices extend above or below 2 standard deviations, and prices sustain this move, the probability of a new trend forming is in your favor. This can be seen in the chart below of the Citigroup. The green circle shows when prices breached the 2 standard deviations below a very long term linear regression line. Prices then stabilized or consolidated there for a time, before showing that a true change in trend was occurring.

C - Citigroup (Click to enlarge)

Citigroup was not alone when this change in trend was starting. Below is a chart of the XLF Financial Sector SPDR. The XLF broke through the one standard deviation below and tried to hold the 2 standard deviations, but as time progressed the change in trend developed and the medium term linear regression shows a channel that has held the down trend since October of last year.

XLF - Financial Sector SPDR (Click to enlarge)

Below are charts of the S&P 500 Index and the Nasdaq 100 Index. Both charts show the linear regression lines and their standard deviation extensions. The longer term linear regression line is 377 periods. This is followed by the medium term linear regression line of 55 periods and the short term of 21 periods. It is important to notice that this applies to periods and not days. The charts above of XLF and Citigroup are actually a three day charts, combining the high, low, and close over three days to make a candle. This three day chart smooths data and eliminates one day wonders.

S&P 500 Index Daily (Click to enlarge)

S&P 500 Index 3day Chart (Click to enlarge)

Nasdaq 100 Index Daily (Click to enlarge)

Nasdaq 100 Index 3day Chart (Click to enlarge)

Combining different time frames of linear regressions can help visually establish where a particular index or security is in relation to its long, medium, and short term trends. This is done by looking at the slope of the linear regression and the individual index or security's location with regards to its standard deviations away from this linear regression. The standard deviations for the long term linear regression(377 period) used in the charts above are 1(white line), 1.5(yellow line, and 2(red line). These are both above and below the linear regression line. The medium(55 period) and short(21 period) term linear regressions only have the 2 standard deviation line applied. The slopes of these linear regressions combined with other various indicators can help spot some changes in trend to keep you ahead of the competition. The key is knowing when to have the math on your side and to fight the temptation of "hoping" prices will go back into the channel. Use stops and trust the math.

How can it be that mathematics, being after all a product of human thought which is independent of experience, is so admirably appropriate to the objects of reality? Is human reason, then, without experience, merely by taking thought, able to fathom the properties of real things.
--Albert Einstein

No comments:

Search

Google