**Warning:** this post will be useless and pointless knowledge unless one is interested in the background and arithmetic involved of deriving McClellan indicators.

I have noticed interest from some of the TW members in creating their own spreadsheets for tracking the McClellan oscillators (MCO) and summation indices McSum). In addition, some excellent discussions in the TW chat room, primarily from Fib, have stressed the importance of not only the MCO and McSum, but their underlying components.

There are several good resources for the underlying mechanics of the McClellan indicators, but for convenience, the following missive addresses the mathematics behind these important tools.

__MCO__

The MCO is simply the result of subtracting the 39 time unit (hours, days, weeks, etc) exponential moving average (EMA) from the 19 time unit EMA.

You will often hear the reference of 5% trends, 10% trends, and other "%" trends used in conjunction with the components of the MCO. The term "trend" used in the MCO jargon, originated when Tom McClellan's parents, Sherman and Marian McClellan, first developed their famous indicators.

Pete Haurlan, an engineer with the Jet Propulsion Lab, published "The Trade Levels Report" in the 1960s, and introduced the use of EMAs to the stock market. From Pete's scientific profession, EMAs were referred to as **trend values**, and were derived for tracking moving objects (targets) to give the heaviest weighting of smoothing moving average to the most recent event in units of time. Thus the origin of % trend used in tandem with McClellan indicators.

The equation for deriving the % trend coefficient is based upon the desired number of time units, I'll use "days", and assigns the heaviest weighting to the most recent events. The basic equation:

**% Trend Coefficient** = 2/(**n**+1), where **n** is the desired number of days to base the EMA upon. The faster EMA for the MCO is the 19 day EMA, thus substituting 19 for "n" in the % trend equation yields:

10% Trend coefficient = 2/(19+1) = 2/20 = 0.10, or **10% trend**, the faster MCO component coefficient.

To derive the 39 day EMA trend coefficient:

5% Trend coefficient = 2/(39+1) = 2/40 = 0.05, or **5% trend**, the slower MCO component coefficient.

Of course, slower or faster % trends can be derived by substituting the desired number of days for the "n" variable in the above equation. To use the coefficients, 0.05 and 0.10, in the MCO derivation, you first need to calculate the daily difference between an indice's advances/declines, up/down volume, or any other type of raw data you wish to construct a MCO from.

To calculate each % trend, we need two coefficients, the coefficient, derived above, i.e. the 0.05 or 0.10, and another coefficient, derived from subtracting the 0.05 and 0.10 from 1. The second coefficient, 1 - 0.05 = 0.95, or 1 - 0.10 = 0.90, provides us the coefficient used to multiply the previous day's % trend value. Thus the 10% trend is derived from this equation (the * implies multiplication):

10% Trend = 0.10 * (today's Advance minus Declines) + 0.90 * (yesterday's 10% Trend value)

Thus, today's Advance minus Decline value constitutes 10% of the today's 10% trend value. An example with advances minus declines equaling 1000, and yesterday's 10% trend equaling 100:

**Today's 10% Trend** = 0.10 * (1000) + 0.90 * (100) = 100 + 90 = 190

The 5% trend formula:

**Today's 5% Trend** = 0.05 * (today's Advance minus Declines) + 0.95 * (yesterday's 5% Trend value)

Once the 10% and 5% trend values are determined, the MCO is calculated:

**MCO = 10% Trend - 5% Trend**

A couple of notes concerning deriving your own MCO numbers:

1) The 10% trend (19 day EMA) requires about 20 days to "settle" and provide reasonably accurate results. The 5% trend (39 day EMA) requires about 40 days to "settle". Thus, the MCO values will likely not match those reported by vendors until you have at least 40 days of data.

2) You often hear about "raw" MCO values and ratio-adjusted (RA) MCO values. The hypothetical daily MCO calculation above is a raw calculation, i.e. we used the actual daily difference between the advances and declines (1000). Using the "raw" approach is fine for shorter time periods, such as a couple of years.

Due to the ever changing numbers of issues traded on an exchange or index, and the ever increasing daily volume, the ratio adjusted, or RA, MCO is used by many vendors, including StockCharts and Decision Point (DP). DP publishes both raw (Carl calls it traditional) and RA MCO numbers.

For historical MCO comparisons, the RA method is a must. I prefer the RA approach when comparing MCOs between different indices, since the number of issues traded in the SML is only 600, while the number of issues traded in the NYSE composite is around 3700. Using raw MCO numbers, comparing the MCOs between the NYSE composite and SML doesn't provide much usefulness when trying compare relative internals strength between the small caps and the entire NYSE list. The RA MCO does provide a meaningful comparison.

The most popular approach for deriving the RA MCO, is as follows:

a) Subtract the declines from the advances (advances - declines) and add the advances and declines (advances + declines).

b) Divide the difference of the advance and declines by the sum of the advances and declines:

(advances - declines)/(advances + declines)

c) The resulting ratio from step (b) will be between +1 and -1. Then multiply the result from (b) by 1000, and use the result in your daily MCO calculations. Using the number "1000" is arbitrary, but is the most popular. It basically "translates" all issues traded in an index to 1000 issues.

__McSum__

The McClellan Summation Index (McSum) is simply derived from summing all of the daily MCO values. The derivation sounds simple, but let's say your database of advance and decline data begins in 2002. You will find your McSum number, derived from summing all of your MCO values from 2002, are not even close to the McSum values reported at StockCharts or DP. Fortunately, mathematician James Miekka derived a "calibration" formula which will allow your McSum numbers to match up with McSum numbers derived from databases going back to 1926.

The Miekka McSum Calibration formula for the 10% and 5% trends is as follows:

McSum = -9 * 10% Trend Value + 19 * 5% Trend Value

The Miekka equation requires at least 40 days of 10% trend and 5% trend values to be valid. Once your 5% and 10% trend values have at least 40 days of history, your McSum numbers will match up with the popular vendors who report McSum values.

Unfortunately, no one seems to know exactly how the late Mr. Miekka derived this amazing McSum calibration tool, but from fooling around with the basic %trend coefficient definition (2/(n+1), I was able to derive the general solution to Mr. Miekka's McSum calibration formula a year or two ago. When using % trends other than the popular 10% and 5%, the coefficients corresponding to the "-9" and "19" in the above Miekka formula, may be derived by the following:

McSum = -(n_{1}-1)/2) * faster trend + (n_{2}-1)/2) * slower trend

The "n_{1}" variable is the number of days used to derive the faster % trend, while the "n_{2}" variable is the number of days used to derive the slower % trend.

Thus substituting 19 days for "n_{1}" yields -(19-1)/2 = -9 for the faster trend McSum calibration coefficient, and substituting 39 days for "n_{2}" yields (39-1)/2 = 19 for the slower trend McSum calibration coefficient.

Another interesting method of deriving the McSum value is using the cumulative advance-decline line's 10% trend (19 day EMA) and 5% trend (39 day EMA). By subtracting the cumulative lines 39 day EMA from its 19 day EMA, you will get the value of the McSum. This method works for any data, advances/declines, up/down volume, etc, whether the data is raw or ratio adjusted.

If any reader is interested in starting their own McClellan indicator database, feel free to contact me and I can mail a sample Excel spreadsheet with the formulas entered in the appropriate cells.

Mortiz