Close

ID'ing When to Buy and Sell Using the Stochastic Oscillator

by Wayne A. Thorp, CFA

ID'ing When To Buy And Sell Using The Stochastic Oscillator Splash image

There is no such thing as a universal indicator. Rather, different conditions dictate the use of different indicators.

Oscillators, which are indicators that move between zero and 100, are useful in identifying conditions where a security may be overextended—overbought or oversold. In the May issue of the AAII Journal, we took a look at one popular oscillator, Wilder’s relative strength index. This article focuses on another popular indicator, the stochastic oscillator.

The Calculation

The word stochastic is defined in general as a process involving a random variable. The stochastic oscillator was first introduced by George Lane in the 1970s. This indicator consists of two lines—the %K and %D lines—and compares the most recent closing price of a security to the price range in which it traded over a specified time period.

The following formula shows you how to calculate the latest point on the %K line:

%K = [(Close – Lo) ÷ (Hi – Lo)] × 100

Where:

Close = Last closing price

Hi = Highest intraday price over the designated period

Lo = Lowest intraday price over the designated period

Therefore, if you were calculating a five-day %K line, the first point would be calculated using the highest price over the last five trading days and the lowest price over the last five trading days as well as the closing price for day five (the last day of the five-day period).

The %D line typically is a three-point moving average of the %K line, and serves as a “trigger” line for generating trading signals. In other words, you add together the last three %K values, divide this sum by three, and continue this over a rolling three-day period. You can use any type of moving average you wish when calculating the %D line, including simple, weighted, or exponential moving averages. [For more on how to use moving averages, see “An Intro to Moving Averages: Popular Technical Indicators,” by Wayne A. Thorp in the August 1999 AAII Journal.]

Like virtually all technical indicators, you can calculate stochastics over any time period you wish, depending on your trading style. The shorter the time period used to establish the high-low comparison, the more responsive the indicator is to price changes which, in turn, will increase the number of signals the indicator generates. Alternatively, as you increase the time period used in calculating an indicator, you increase the time in which it takes to respond to current price movements. This lowers the number of signals the indicator generates. Also, keep in mind that you can use any time increment as well—minute, hour, day, week, month, etc. The same principles apply no matter the time period or increment you use.

Fast Vs. Slow Stochastics

The formula we provided on page 24 to calculate points on the %K line leads us to a stochastic oscillator that is extremely volatile and, therefore, is often referred to as a “fast” stochastic. Lane realized that due to the fast stochastic’s volatility, it was not very useful as a trading tool because it generated frequent and often inaccurate trading signals. In an attempt to create an indicator that was less volatile and, therefore, more useful, Lane created a “slow” stochastic by:

  • Making the original %D line the new %K line—the stochastic is “smoothed” or slowed by averaging over three points. In other words, the new %K line is a three-point moving average of the fast %K line; and
  • Using a three-point moving average of the original %D line as the slow stochastic’s %D line. Therefore, we are taking the original %K line, smoothing or averaging it over three points, and then averaging this line over three points once more.

Figure 1 illustrates both the fast (upper window) and slow (middle window) stochastics for Global Marine. In both instances, the %K line is the solid line, and the %D line is the dotted line. In both stochastic windows, the two horizontal lines mark the overbought (indicator value above 80) and oversold areas (indicator value below 20) as defined by Lane. As we will see later, the movements of the %K and %D lines above and below these levels are useful when timing your buy and sell decisions.

The numbers in parentheses on the chart indicate the number of points used in calculating the moving averages period used. Looking at the slow stochastic in the middle window, you see (5,3) after the %K label. This indicates that the points on the %K line are calculated over five points and then “smoothed,” or averaged, over three points. The %D lines in Figure 1 are a three-point moving averages of their respective %K lines.

When comparing the slow and fast stochastics, you can immediately see that the slow stochastic is more rounded and less volatile than the fast stochastic. Note, also, that there are times when the fast stochastic lines either cross above 80 or below 20, while the slow stochastic lines do not. By slowing the lines, the slow stochastic generates fewer trading signals.

SPECIAL OFFER: Get AAII membership FREE for 30 days!
Get full access to AAII.com, including our market-beating Model Stock Portfolio, currently outperforming the S&P 500 by 4-to-1. Plus 60 stock screens based on the winning strategies of legendary investors like Warren Start your trial now and get immediate access to our market-beating Model Stock Portfolio (beating the S&P 500 4-to-1) plus 60 stock screens based on the strategies of legendary investors like Warren Buffett and Benjamin Graham. PLUS get unbiased investor education with our award-winning AAII Journal, our comprehensive ETF Guide and more – FREE for 30 days
sign-up

Interpretation

You can see in the figures that the stochastic oscillator fluctuates between zero and 100. A stochastic value of 50 indicates that the closing price is at the midpoint of the trading range for the specified period. As values reach above 50, it indicates that the price is moving up into the higher trading-range for the period. The opposite is true when values fall below 50—the price is moving into the lower levels of the trading range for the period.

At the extreme, a value of 100 signals that the price closed at the absolute highest point for the period, while a value of zero means that the price closed at the lowest point for the period.

The three most common ways to use the stochastic oscillator are divergences, crossovers, and oversold/overbought.

Divergences

When Lane first introduced stochastics, he believed that the only valid signal occurred when a divergence developed between the price and the stochastic oscillator, more specifically the %D line. Divergences between price and an indicator occur when the behavior in the price is not mirrored by the indicator.

A bearish divergence, for example, takes place when the prices are making higher highs while the stochastic is making new lows (preferably below 20), or is failing to also make new highs. This occurs because, while prices are reaching new intraperiod highs, the closing prices are falling. When you see this, you can reasonably expect the price to fall in line with the indicator—which means prices will reverse course and begin to fall.

Figure 2 provides an example of a bearish divergence between the daily price of Photon Dynamics and five-day stochastics (with three-day slowing). As you can see, prices moved in a generally upward direction (higher highs and higher lows) from late June through the middle of July—creating three successive peaks, each higher than the previous. At the same time, however, the stochastic oscillator was moving in the opposite direction, creating two successively lower peaks—both of which are above 80. Eventually, prices followed the stochastic, reversed course, and fell from a high of $85 to a low near $45 in less than a month.

Bullish divergences occur when the price is making new lows while the oscillator is making new highs—or failing to make new lows—below the 20 line. Here you can expect prices to bottom out and begin to rise, matching the behavior of the indicator.

Overbought & Oversold

The horizontal lines at 20 and 80 mark overbought and oversold areas for a given security. A security is considered overbought when the stochastic lines rise above 80 as closing prices near intraperiod highs. Likewise, it is viewed as oversold when they cross below 20 indicating closing prices are near the intra-period low. These levels represent points where one would expect prices to reverse—the extreme price levels are not sustainable over time. Note that either line—the %K line or %D—may be used, although most technicians consider the %D line to be more accurate.

There are several strategies that can be used based on overbought and oversold levels.

The strictest rule would be to sell when the %D line crosses above 80—in other words, when the stock becomes overbought—and buy when it crosses below 20 and becomes oversold. This strategy, however, has flaws. To begin with, there is no indication as to how long the security will remain at the price extremes, meaning that the security could become even more overbought or oversold. Therefore, if you sold when the %D line crossed above 80, you run the risk of missing further price gains, just as you run the risk of buying prematurely before the price bottoms if you buy when the line crosses below 20.

A more conservative approach is to allow the oscillator to cross either above 80 or below 20 and wait until it reverses itself—in other words, wait until it crosses back below 80 before selling and wait until it rises above 20 before buying. While you risk giving up some of your price gains or missing out on some or all of the upward movement, over time this strategy tends to perform better.

Crossovers

The stochastic oscillator is unique compared to other oscillators, such as Wilder’s relative strength indicator, because it is composed of two lines instead of just one. Therefore, as with indicators such as multiple moving averages and the MACD (moving average convergence/divergence), potential trading signals arise when the %K line crosses the %D.

Generally speaking, a buy signal is generated whenever the %K line moves above the %D line. Likewise, a sell or short signal occurs when the %K line crosses below the %D line.

For the most reliable signals, technicians typically wait to act on crossovers until the %K and %D lines are in the overbought or oversold zones—above 80 and below 20, respectively. Therefore, a stronger sell signal would be when the %K line crosses below the %D line when both are above 80, and a stronger buy signal would be when the %K rises above the %D line when both are below 20.

Further study has shown that the side of the %D line on which the crossover by the %K line takes place can also be a factor in how profitable the trade may be. “Right-side” crossings, which tend to be more profitable than “left-side “ crossings, take place when the %K line crosses after the %D line has reached an extreme.

Breakdowns

Stochastics are most useful in identifying short(er)-term price swings. In addition, the indicator is most reliable when used with a security whose price moves within a trading range. On the other hand, problems tend to arise when you attempt to use the stochastic oscillator in trending markets.

Oscillators in general perform poorly during strong, prolonged trends—either upward or downward. During strong uptrends, the stochastics tend to move into the overbought range (above 80) and can stay there for an extended period of time. Furthermore, during such trends, movements by the indicator below 80 tend not to be indicative of a reversal in the overall trend. The same is true for divergences that occur in trending markets, which also tend to generate false signals.

One way to avoid trading on these false signals is to only trade on those signals that are in the direction of the overall trend. In other words, sell when the price is overbought only when there is a confirmed downtrend, and buy when the price is oversold only if the trend is up.

Figure 3 is an example of how the stochastic oscillator “breaks down” during a prolonged trend. Here, PsiNet experienced a steady decline from early March through late April. During this time, the stochastics fell from above the 80 line to below the 20 line. Subsequently, it rose above 20 four other times during this period. If you had purchased the stock on any of these crossovers above the 20 line, you would have seen three of the four trades lose money as the price fell from $60 to below $20, eventually staging a small rally.

Conclusion

Stochastics, like any technical indicator, can be a useful tool in implementing your trading strategy as long as you understand both its strengths and weaknesses.

Stochastics work best with those securities that are in a trading range or are non-trending. Under these conditions, the stochastic indicator may prove useful in identifying buying and selling points based on divergences between the indicator and the security’s price, the interaction between the %K and %D lines that make up the oscillator, as well as when a security may be overbought or oversold.

But stochastics can return false signals, especially during strong up- and downtrends. Using stochastics with other indicators can help reduce the risk of entering a trade against the overall trend.

Wayne A. Thorp, CFA is a vice president and senior financial analyst at AAII and editor of Computerized Investing. Follow him on Twitter at @WayneTAAII.


Discussion

You need to log in as a registered AAII user before commenting.
Create an account

Log In