The Stochastic Oscillator
Abstract
The stochastic oscillator is one of the first generation tools in technical analysis. It was created in the 1950s, when personal computers were not yet invented. Consequently, its structure is very simple however; it is quick when giving a change in the direction of prices. Today there are several variants. Here we look at the classic stochastic using %K and %D.
One definition of the term “stochastic” is that events can be predictable. In technical analysis this means that a series of prices may contain the clue to predict their future behaviour.
As intended by George C. Lane, the promoter of the stochastic oscillator in the 1950s, this indicator detects a change in price that anticipates a change in the direction of the actual trend. Here the meaning of trend is broad: it can be a micro trend as well as a short, medium or longterm trend. It all depends on the period (for example; 5 minute, 30 minute, daily close, etc.) as well as the total number of periods used by the indicator (9, 14, 20, etc.).
The basic principle of the stochastic is the following: in a downtrend the closing price is in the lower part of the price range of the period; in an uptrend, it is in the higher part of the range. The signal of a probable imminent change is given when the behaviour of the closing price is inverted. It becomes closer to the upper part of the range in a downtrend or closer to the lower part in an uptrend.
All indicators of technical analysis (there are currently approximately fifty) follow the same principle of probability. However, they can differ on the timing of the signal due to the structure of each instrument. There are two families of indicators: those without, or almost without moving averages, and those derived from moving averages. The first group is quicker in giving a signal that the second.
The stochastic oscillator is a member of the first group. On the other hand, an indicator using two moving averages is a member of the second group. In the case of the latter, a signal is given when the shortterm moving average (example: EMA 7) crosses a longterm moving average (example: EMA 27).
The stochastic oscillator gives a signal at the bottom and at the top of a trend. The crossing of the two moving averages (EMA 7 and EMA 27) offers a signal after the beginning of a new trend. In this case we lose part of the potential profit when we take or we close a position.
Of course, there is a downside with the first group. The closer the signal is to the trend, the higher the number of signals with small profits and/or false signals. On the contrary, the use of the EMA 7 and EMA27 will offer fewer signals, less false signals and more conservative signals.
A word about the meaning of “false signal”: A signal is considered “false”, when it offers no substantial profit and may also generate a small loss, mainly given by the difference in the bid/ask prices.
The stochastic oscillator appeared more than 50 years ago. Over time, several variants were created and made available in trading platforms and technical analysis software. Personally, I use the more classic version. Here is the how it is constructed:
 Number of periods: 14

Each period is:
 A 5minute period in day trading.
 A daily close for longer trading.
In Table 1, we see a series of prices: the daily high, low and close of 14 trading sessions of Agrium Inc. (AGU.TO).
The basic formula of the stochastic oscillator is:
 Step One: subtract the lowest low of the 14 periods from the last closing price ($50.11  $60.03 = $9.92$).
 Step Two: subtract the lowest low of the 14 periods from the highest high of the 14 periods ($50.11  $60.04 = $9.93).
 Step Three: divide the first result by the second result and multiply the quotient by 100. The result, 99.90 is what we call the %K.
 Step Four: on a daily basis, remove the first range of prices and add the new high, low and close. These prices become those of the new 14th period.
In practice we ignore these calculations: computers do them automatically.
The %K tells us that the last close of AGU is practically at the top of the range of prices occurring over the last 14 days. This information is not in itself very useful because it can indicate that the trend is strong and will continue to go up but, may also show that the trend is too strong and could soon reverse.
The best use of %K is to add a 3day moving average. The 3period moving average of %K is in the classic version of the stochastic oscillator and its symbol is %D.
Now we can use the %K combined with %D in this way:
 In an uptrend, when the %K crosses down the %D line the uptrend is about to change direction.
 In a downtrend when the %K crosses up the %D line the downtrend is about to change direction.
Figure 1 is an illustration of the advantages offered by the stochastic.
The arrow A in the stochastic graph indicates a sell signal. Looking at the corresponding price in the bar chart we see that the signal is given at the top, just before the beginning of the downtrend. We make the same observation for the arrow C at the end of a downtrend.
In the bar chart there are two moving averages. When the EMA 7 crosses the EMA 27 (arrows B and D) we get a signal of a new trend; but it is well behind the signal given by the stochastic oscillator. This is an illustration of the hierarchy of signals.
In the stochastic graph there are two horizontal lines: at 20 and at 80. I don’t use them, because each crossing of the %K with %D, wherever they occur in the graph, is meaningful, revealing sometimes a very small change in the direction of prices; but also very important and profitable movements.