A Deep Dive Into Stochastics

We often see indicators drawn on a chart. Many times, an analyst will not even explain why the indicators are shown. At other times, they will claim an indicator has some important meaning. Rarely, if ever, does an analyst support their claim about an indicator with facts.

The truth is many indicators do not work as their proponents claim they do. They merely show the “well selected example” which is the one time the indicator worked perfectly. With this technique, the failures of the indicator are ignored. Even when they are visible on the chart.

Well selected examples are not necessarily deceptive. The analyst often has a sincere belief in their work. However, the analyst also often has a bias related to their work. Their mind focuses on the successes and ignores the misses. This is natural and is why unbiased, computerized testing can be valuable to analysts.

This week, we will apply that unbiased process to the stochastics indicator.

A Definition of the Stochastics Oscillator

Stochastics is a popular indicator that is designed to measure momentum. A market analyst named George Lane is usually given credit for developing the indicator. That is disputed by others and a reading of the history of stochastics shows that there is no clear answer.

No matter who developed the tool, lane certainly popularized it. As he described it, “Stochastics measures the momentum of price. If you visualize a rocket going up in the air – before it can turn down, it must slow down. Momentum always changes direction before price.”

The same idea applies to a golf ball, which many of us are more familiar with. The gold ball flies off the tee and arcs higher, at least when the pros do it on TV. The ball levels off and as it does its momentum slows.  Then, it begins to fall and its momentum accelerates to the downside.

Stochastics, and other momentum indicators, apply this idea to prices. Technical Analysis of Stock generally believe that a close near the high is bullish and a close near the low is bearish. Stochastics quantifies this belief with the formulas shown below.

The indicator consists of two lines. One is slow (%K) and the other is fast (%D). The calculation is, of course, done for us at many free web sites including StockCharts.com and TradingView.com. An example of the calculation is shown in the chart below.

Because of the way it is calculated, the indicator will always have a value between 0 and 100. It will oscillate around 50, the midpoint. Movement around a midpoint makes stochastics an oscillator. The fact that it is bounded within a range allows us to create rules defining when we should expect a reversal.

Interpreting the Indicator

In the chart above, %K is shown in green and %D is shown in red. These colors were chosen to illustrate how the indicator can be used as a trend following strategy. This interpretation is equivalent to the way a moving average would be interpreted.

When the slow line is above the fast line, the trend is up. Think of price (the fast line) and a moving average (a slow line) to visualize this relationship. When the fast line is above the slow line, the trend is down. In the chart above, when the green line is on top, there is a buy signal. A sell signal is given when the red line tops the green line. The chart shows this seems to be a useful indicator.

Crossovers are just one way that stochastics are used. The indicator also identifies potential trend reversals when it becomes overbought or oversold. An overbought condition exists when momentum has moved up too fast and an oversold extreme occurs when momentum falls too fast.

In the chart above, extremes are marked with solid grey lines. The oversold level for stochastics is usually set at 20. Overbought is defined as reading above 80. The idea is that prices are due to decline when the indicator moves above 80. A reading below 20 is believed to indicate a rally in prices is imminent.

The next chart brings this assumption into question.

You can see that oversold extremes are marked by a vertical line. In two of the three examples, prices continued to fall. In two of the cases, when the indicator moved back above 20, it served as a useful buy signal. But, we don’t know if this is how the indicator normally behaves. We all have biases that impact what we see when we look at a chart.

Quantitative Testing Can Overcome Biases

We can develop rules for testing the stochastics oscillator and generate unbiased data by looking at the test results. A number of tests are possible but we will start with the simplest. We will simply buy when the fast line (%K) is above the slow line (%D). We will sell and hold cash when that is not the case.

Our test will be on the stocks that are in the S&P 500 and will include ten years of data ending with July 31, 2017. To simulate the results of an actual trader, we will deduct $5 for commissions from each trade.

Over the past ten years, using weekly data, this strategy would have provided a win rate of 46%. This trading system provided an average annual return of 2.22%.

Let’s rerun our test using daily data. Now, the win rate is 43% and the losses are large. On average, taking every signal given by the indicator would result in a loss of more than 20% a year. This is an active trading strategy and commissions hurt a great deal but even without commissions, the strategy loses money. And, you should never ignore commissions because your broker will charge you to trade.

The conclusion from this test is clear – stochastics should not be used as a simple trend following strategy. But, will it work to find trend reversals? Once again, we can test that question and we will limit our results to long trades. We will buy when stochastics becomes oversold.

For the test, we will use a simple time exit and compare the results to a random entry.

Using stochastics, buying when the indicator falls below 20, 60% of trades would be winners. Selling 13 weeks later (about 3 months), the average annual return for this system would be 12.78%. Using daily data, the win rate increases slightly to 62.5% and the average annual gain increases to 17.7%.

Using a random entry and the same exits, the weekly win rate would have been 63.2% and the average annual return would have been 17.97%. With daily data, the random entry win rate would be 61.8% and the average annual return would be 15.43%.

Let’s consider one more test, buying when the indicator crosses above 20 after becoming oversold. With weekly data, the win rate is 56.4% and the average annual return for the strategy is 4.75%. With daily data, the win rate is 61.6% and the average annual return was 15.84%.

Reviewing the Data

The question we set out to answer was whether or not the stochastics indicator could beat the market. As a trend following strategy, the answer was a clear “no.” Using the indicator to identify oversold signals, the data is less clear.

Buying when a stock first becomes oversold is not a market beating strategy on weekly data. Buying when the stock recovers from being oversold is also not a market beating strategy with weekly data. With daily data, both ideas are slightly better than random entries. But the results are not so much better than random entries that the answer is clear that the stochastics indicator will always be better than average.

Based on the data, the stochastics should be considered an input into a trading strategy rather than an absolute trading strategy. There are other tests worth pursuing, like buying when the indicator becomes overbought or buying when it moves above 50. These are topics we will explore in the future. But, it seems clear that stochastics should not be used in the traditional way without adding additional indicators to the analysis.