**The McClellan Oscillator**

**Market Data Questions**

# Calculating the McClellan Oscillator

I've been trying my hand at calculating the McClellan Oscillator. One version that describes it calls for using the difference between an exponentially smoothed 39-day moving average and a 19-day moving average. A second version just calls for using exponentially smoothed data with a 10% smoother and a 5% smoother.

Perhaps I've not done either correctly but neither agrees with the values shown almost daily on CNBC. What I've used is the exponential smoothing function provided in MS Excel.

1. Is the function I've used the proper one?

2. Are the data shown by CNBC correct?

3. Is there another source of information about doing the calculation?

The McClellan Oscillator and Summation Index were developed by my parents back in 1969. Calculation of these indicators starts with the daily A-D difference, as you have probably already discerned. Two different exponential moving averages, the 10% Trend and the 5% Trend, are calculated to smooth the daily A-D data, and the McClellan Oscillator is the numerical difference between these two moving averages. The Summation Index is the total of all previous McClellan Oscillator values, and it is neutral at +1000 when calculated and calibrated properly.

Excel does contain an "exponential smoothing" routine in its Data Analysis set (see its Tools menu), and the description shows it to the same thing as an exponential moving average as most technical analysts would define the term. But one need not go through the complex indicator menus in Excel to construct these indicators.

The 10% or 5% figure refers to the smoothing constant of the moving average. The best way to think of it is that for the 10% Trend (for example), the new value for today's 10% Trend would be moved from yesterday's value by an amount equal to 10% of the difference between today's price (or A-D difference) and yesterday's 10% Trend value. Stated algebraically, it reads:

10%T(today) = 10%T(yesterday) + 0.1x[Price(today) - 10%T(yesterday)]

This can be further reduced to read:

10%T(today) = 0.9 x 10%T(yesterday) + 0.1 x Price(today)

The same calculation would work for a 5% Trend except that you would use 0.95 and 0.05. The reference to a set number of days (e.g. 19 or 39) refers to a formula which states that the smoothing constant can be chosen to correspond to a certain period by using the formula 2/(n+1), where n is the number of days. Thus a 19-day period would calculate out to:

2/(19+1), or 2/20, or 1/10, which is really 10%.

We prefer not to refer to EMAs by a number of days, since this is somewhat misleading. With a simple moving average (SMA), the old data does disappear from the calculations. So if you have a 50-day SMA, the price value from 51 days ago does not matter at all, while the one from 50 days ago matters just as much as the one from 1 day ago. With an exponential moving average, the effects of the old data never completely disappear, they just become progressively less relevant.

We prefer instead to identify EMAs by their tracking rates, and so we use the terminology originally assigned by the late P.N. Haurlan. In the 1960s, Haurlan was the first person to write about using exponential moving averages for analyzing stock prices. He was an actual rocket scientist who worked at JPL in the day time and then analyzed stocks at night. For more on Haurlan, see 2004 MTA Booklet.

CNBC no longer publishes the Oscillator and Summation Index values on a daily basis. Differences between your numbers and those of any other source may be a function of different data and/or calculation errors on either end. If you want to know what the numbers are every day, you can visit our Daily Data Page. New numbers are posted at around 4:00 PM Pacific Time each day.