FuturesTechs Logo

FuturesTechs Blog

Posts Tagged ‘stochastic oscillator’

Technical Analysis Tutorial: The Stochastic Oscillator

Tuesday, July 7th, 2009

As part of our continued efforts to explain the major technical indicators to our clients, what follows is a simple explanation of the Stochastics momentum indicators often used in our analysis.

Originally devised by George C. Lane in the 1950s, the Stochastic oscillator is one of the easiest indicators to interpret. It tells us where the price sits in relation to its recent trading range, in a fixed 0 – 100 range and using different degrees of smoothing to provide some stability. Coming in a few different versions, their interpretation rests on the sensible assumption that price pressure is on the upper end of the range in an uptrend, and on the lower end in a downtrend.

Before we create a Stochastic oscillator, we need to decide what time parameter to use. Ten periods is our preferred choice for our daily charts, capturing the range of the previous two weeks.

The simplest one, the Fast Stochastic, has two lines: %K and %D, calculated as follows:

•    %K = [close – low (N-range)]/[high(N-range) – low(N-range)]
•    %D = SMA (%K)

So %K is the position of the most recent close in the range of the last N days; if the close was the low, we get 0, while if the close was the high, we get 100. And %D is the simple moving average of this series (we also need to choose a period for this moving average; typically, we use 3).

Fig 1. Fast Stochastics

It’s always helpful for an indicator to be bounded in a constant range, such as this is between 0 and 100. For one thing, we don’t need to worry about long-run matters like inflation: you’d get a similar pattern for an uptrend in the Dow whether you were looking at it in 1950 or 2000, without any need to rescale it. This means we can easily look for recurring patterns in a market over a period of decades.

It also means that we can easily use the indicator for intermarket analysis. Since the oscillator is bounded as it is, the patterns have the same size regardless of whether you’re watching a stock that trades for £1.00, £20.00 or £50.00, a currency pair or an interest rate future!

Getting back to the main topic, the only major problem with the Fast Stochastic is the lack of smoothing. Note how jagged the %K (blue) line is in the FTSE Index chart above. It reaches extreme readings quite frequently, jumping about and making it hard to interpret.

The solution is easy: we use the smoother red line of the Fast Stochastic as our blue %K line instead, and then average it and use the new average as our new red line! So the new red line is the average of the average of the old blue line (simple, isn’t it?!) And this is how we construct the “Slow Stochastic”.

Fast Stochastic:

  • %K = position in N-range
  • %D = SMA (%K)

Slow Stochastic:

  • %K = %D (Fast Stochastic)
  • %D = SMA (%D (Fast Stochastic))

Fig 2. Fast Stochastics vs. Slow Stochastics

We can compare the different Stochastics in the chart above. Observe that the slower red line in the Fast Stochastic is identical to the faster blue line in the Slow Stochastic.

Now we can see the advantage of the Slow Stochastics: they don’t reach the overbought/oversold levels so easily, meaning that we are whipsawed less frequently.

What are these overbought and oversold levels? Generally, we consider anything above 80 to be overbought, and anything below 20 to be oversold.

This system of lines provides a bunch of easily observed buy/sell signals. The simplest of these is simply to take a buy signal when % K crosses the slower % D line from below and a sell signal when it crosses from above. However, this generally happens much too frequently to provide useful signals.

The solution most commonly used is to wait until the slower %D line makes it into one of the extreme overbought/oversold regions, and only use crossovers which occur there. This gives us fewer false signals, with those we do get more likely to be at genuine market turning points.

Another technique, which Stochastics have in common with other indicators, is divergence: when the oscillator moves in the opposite direction to price. This is a warning sign that a trend is running out of momentum. So, for example, if we have an uptrend on the price chart with a sequence of higher highs being formed, but the Stochastics are forming a sequence of lower lows, then we can say that the uptrend is losing momentum and that we will give extra weight to any argument that a reversal is underway. The chart below illustrates one of those divergence scenarios with a resultant sell-off.

Fig 3. Divergence of Price and Slow Stochastics

As with other oscillators, the biggest danger when using it is to assume that a reversal is imminent simply because it is at an extreme measurement. This isn’t necessarily true! Price pressure will remain on the upper end of the range, and hence the Stochastic will stay at elevated levels, for as long as the market is trending.

Fig 4. Sustained “overbought” Stochastics measurement.

In the Soybeans futures market recently, for example, the Slow Stochastics remained in the overbought region from May 6th to June 11th. Why wait for a reversal through all of time, instead of just running with the trend? The Stochastic crossover signal is an excellent counter-trend signal, but that’s not much use when the market just keeps on trending.

This would have been a better market to trade with the Stochastics:

Fig 5. Ranging market with useful Stochastic signals.

We weren’t so strict as to wait for the %D (red) line to get into overbought/oversold territory before we accepted a signal, but most of them worked pretty well. The two signals in red font weren’t successful (we were mostly flat after the red buy signal, and the market rallied after the red sell signal), but six of the eight crossovers were followed by decent moves in the direction of the signal.

The lesson: always adapt your indicators to the market you’re trading, and remember that even when it appears to be working, no signal is infallible!

Graham Neary MSTA (graham@futurestechs.co.uk)

Spread betting the footsie: Sell in May and Go Away - does it work?

Wednesday, May 27th, 2009

‘Sell in May and go away, come again on St. Leger’s Day’, or so the ancient wisdom goes. According to convention, investors do well by exiting the stock markets during the quiet summer months, only returning in mid-September.

Not satisfied with old wives’ tales here at FuturesTechs Towers, we decided to do a little bit of empirical research and find out for ourselves if this had worked in years gone by.

In order to spice it up a little bit, and to add some “timing” to the whole affair, we also decided to consider the amendment offered by another technician (the excellent and well-respected Axel Rudolph at Dow Jones): “Sell in May and go away, come again on St. Leger’s Day so long as there is a Stochastic crossover sell signal.” Ooh-err!

The results?

It turns out that this rule hasn’t been too bad at all, looking back for the last 20 years.

We put the start of the summer period as the day of the first Stochastic crossover sell signal in May or, if there was none, as May 31st. The end of the summer was defined as the day of the St. Leger Stakes, the horse racing meet in Doncaster that’s been running since the 18th century, and which is always held in mid-September. We use the Slow Stochastic indicator with the typical parameters.

So here’s a simple comparison: the returns for each of the last twenty years (blue) versus the annualised returns for each summer (red):

Fig 1.

The chart shows that the red series was quite a bit lower than the blue series on a couple of occasions (1992, 1998, 2001, 2002, for example), meaning that summer returns were much worse than the annual returns in each of those years. And we also see that the years in which the summer significantly outperformed the year as a whole weren’t very common.

So now let’s compare the same annual returns versus the returns achieved by sitting out during the summer period (selling in May and coming back in September). The annual returns are in blue again, with the returns from the “Sell in May” strategy in purple:

Fig 2.

This shows that the returns from sitting out for the summer months were better than for the year as a whole in 1990, 1992, 1998, 2001, 2002, 2006, 2007 and 2008.

What’s also going on here, though, is that the returns from summer were greater than zero for 11 of the 20 years in question, so that for each of these years you were better off staying invested rather than sitting out. Even if the summer returns weren’t that great, they were better than the zero gained by doing nothing for that time.

In general, though, the records show that there has been some good success in leaving the fray for summer, as illustrated by this summary:

1989-2008                          Average Returns

Annual                                      6.03%

Summer (annualised)          -1.03%

Sell in May Strategy                7.39%

The average return for each of the past 20 years has been 6.03% but, by employing the Sell in May strategy, the average return rises to 7.38%. The average of the annualised returns for the summers has actually been negative.

Now let’s look at the suggested amendment to the rule, and use the Stochastic sell signal. We find that when you only sell out in the years when there was a sell signal, the strategy does improve a little. This is illustrated by Figure 3, where we simply stayed invested for the years when there was no signal:

Fig 3.

Waiting for a Stochastic sell signal meant that you would still have been protected from summer losses in 1990, 1992, 2001, 2002, 2006, 2007 and 2008 (you would have suffered pretty big losses last year anyway, of course). This strategy performed worse than simply staying invested for the year in 1989, 1991, 1993, 1995, 1997 and 2005. The average return from this strategy, however, is still an improvement on simply selling out (which was already an improvement on staying invested):

1989-2008                                  Average Return

Annual                                             6.03%

Sell in May                                      7.39%

Sell Signal Strategy                      7.49%

Looking exclusively at the years when there was a sell signal, the worst return (except for 2008) was -3%! Some people might consider this to be good value risk management, even if it means missing out on some growth during good years

Our summary box looking only at the years with a sell signal helps to prove how the rule made a big difference:

Sell Signal Years                     Average Return

Annual                                              5.75%

Summer (annualised)                  -3.64%

Sell in May Strategy                         8.01%

This isn’t a very formal analysis, of course, but could be worth thinking about. In terms of this year, we had a Stochastic sell signal for the FTSE on the 13th of this month (the vertical line on the chart below).

Fig 4: Stochastic sell signal for the FTSE-100 index, 13th May 2009

The market has gained a little more since the signal, but anybody who thinks that the rally is probably over now might take encouragement from the historical record of weak summer trading. That would make this an opportunity to get out, only coming back for race day in Doncaster next autumn.

Graham Neary (graham@futurestechs.co.uk)

web design company: Silkstream