## Kinds Of Oscillators

There are two main forms of oscillators. Linear band-pass filters are one form of oscillator. They may be analyzed for frequency (periodicity) and phase response. The MACD and MACD-H are of this class. Another form of oscillator places some aspect of price behavior into a normalized scale (the RSI, Stochastics, and belong to this class); unlike the first category, these oscillators are not linear filters with clearly defined phase and frequency behavior. Both types of oscillators highlight momentum and cyclical movement, while downplaying trends and eliminating long-term offsets: i.e., they both produce plots that tend to oscillate.

The Moving Average Convergence Divergence Oscillator, or MACD (and MACD-Histogram), operates as a crude band-pass filter, removing both slow trends and offsets, as well as high-frequency jitter or noise. It does this while passing through cyclic activity or waves that fall near the center of the pass-band. The MACD smooths data, as does a moving average; but it also removes some of the trend, highlighting cycles and sometimes moving in coincidence with the market, i.e., without lag. Ehlers (1989) is a good source of information on this oscillator.

The MACD is computed by subtracting a longer moving average from a shorter moving average. It may be implemented using any kind of averages or low-pass filters (the classic MACD uses exponential moving averages). A number of variations on the MACD use more advanced moving averages, such as the VIDYA (discussed in the chapter on moving averages). Triangular moving averages have also been used to implement the MACD oscillator. Along with the raw MACD, the so-called MACD Histogram (MACD-H) is also used by many traders. This is computed by subtracting from the MACD a moving average of the MACD. In many cases, the moving average of the MACD is referred to as a signal line.

The Stochastic oscillator is frequently referred to as an overbought/oversold indicator. According to Lupo (1994), "The stochastic measures the location of the most recent market action in relation to the highest and lowest prices within the last " n bars. In this sense, the Stochastic is a momentum indicator: It answers the question of whether the market is moving to new highs or new lows or is just meandering in the middle.

The Stochastic is actually several related indicators: Fast %K, Slow %K (also known as Fast %D), and Slow %D. Fast %K measures, as a percentage, the location of the most recent closing price relative to the highest high and lowest low of the last n bars, where n is the length or period set for the indicator. Slow %K, which is identical to Fast %D, applies a 3-bar (or 3-day) moving average to both the numerator and denominator when computing the %K value. Slow %D is simply a 3-bar simple moving average of Slow %K; it is occasionally treated as a signal line in the same way that the moving average of the MACD is used as a signal line for the MACD.

There have been many variations on the Stochastic reported over the years; e.g., Blau (1993) discussed a double-smoothing variation. The equations for the classical Lane's Stochastic are described in an article by Meibahr (1992). A version of those equations appears below:

Fast %K for ith bar = 100 * [C(i) - B(i)] / [A(i) - B(i)]

Slow %K = Fast %D = 100 * [F(i) - E(i)] / [D(i) - E(i)]

Slow %D = 3-bar simple moving average of Slow %K

In these equations, i represents the bar index, H(i) the high of the ith bar, L(i) the low of the ith bar, and C(i) the close of the i'th bar. All other letters refer to derived data series needed to compute the various Stochastic oscillators. As can be seen from the equations, the Stochastic oscillators highlight the relative position of the close in a range set by recent market highs and lows: High numbers (a maximum of 100) result when the close is near the top of the range of recent price activity and low numbers (a minimum of 0) when the close is near the bottom of the range.

The Relative Strength Index, or RSI, is another well-known oscillator that assesses relative movement up or down, and scales its output to a fixed range, 0 to 100. The classic RSI makes use of what is essentially an exponential moving average, separately computed for both up movement and down movement, with the result being up movement as a percentage of total movement. One variation is to use simple moving averages when computing the up and down movement components. The equations for the classic RSI appear below:

C/(i) = Highest of 0, C(i) - C(i - 1) D(i) = Highest of 0, C(i - 1) - C(i) AU(i) = [(n 1) * AU(i - 1) + U(i)] / n AD(i) = [(n - 1) * AD(i - I) + D(i)] / n RSKi) = 100 *AU(i) / [AU(i) + AD(i)]

The indicator's period is represented by n, upward movement by U, downward movement by D, average upward movement by AU, and average downward movement by AD. The bars are indexed by /. Traditionally, a 14-bar RSI (n = 14) would be calculated. A good discussion of the RSI can be found in Star (1993).

Finally, there is the Commodities Channel Index, or CCI, which is discussed in an article by Davies (1993). This oscillator is like a more statistically aware Stochastic: Instead of placing the closing price within bands defined by recent highs and lows, the CCI evaluates the closing price in relation to bands defined by the mean and mean deviation of recent price activity. Although not discussed further in this chapter, the equations for this oscillator are presented below for interested readers:

X(i) = H(i) + L(i) + C(i) A(i) = Simple n-bar moving average of X(i) D(i) = Average of | X() -k)-A(i) fork = 0 to n - 1 CO(v) = [X(i) - A(i)] / [0.015 * D(i)]

In the equations for the Commodities Channel Index, X represents the so-called median price, A the moving average of X, I) the mean absolute deviations, n the period for the indicator, and i the bar index.

Figure 7-l shows a bar chart for the S&P 500. Appearing on the chart are the three most popular oscillators, along with items normally associated with them, e.g., signal lines or slower versions of the oscillator. Also drawn on the subgraph containing the Stochastic are the fixed thresholds of 80 and 20 often used as reference points. For the RSI, similar thresholds of 70 and 30, traditional numbers for that oscillator, are shown. This figure illustrates how these three oscillators appear, how they respond to prices, and what divergence (a concept discussed below) looks like.

## Post a comment