The Stochastic oscillator is based on the commonly accepted observation that prices tend to close near the upper part of the trading range during an uptrend and near the lower part during a downtrend. That is, the oscillator compares where the underlying instrument’s closing price is relative to its price range over a given period of time.
The Stochastic oscillator is displayed as two lines:
- The main line is called %K, which is a smoother version of the %K-fast.
- The second line called %D, which is a smoother version of the main line %K.
This double smoothening of the %K-fast line produces what is known as the “Slow” Stochastic. The fast version of stochastic is also used, but most traders prefer to use double smoothing since the signalling becomes slower, but much more reliable.
The %K is the more sensitive of the two lines, but it is the %D line that carries the greater weight and provides most of the signalling. The %K measures on a percentage basis (0% to 100%), where the closing price is in relation to the total price range for the given period.
A common combination used for this oscillator is (5/3/3) meaning 5 periods for deriving %K-fast and then using a 3-Day moving average for deriving %K, and another 3-Day smoothing for deriving %D.
The formula to determine %K-fast is:
Close is the current close
Lowt is the lowest low
Hight is the highest high
What the formula is actually measuring is the % distance covered by the closing in relation to the high/low extremes of the period in question.
Smoothing %K-fast by using a 3-Day simple moving average for producing %K:
A full guide to the calculation and construction of the Stochastic oscillator with a period of 5 days is provided in excel format for your better understanding.
Stochastic Oscillator (K%D)
Interpretation & Trade Signals
The Stochastic oscillator can produce valid signals in both trending and sideways markets. This setup however works much better in a range environment when overbought and oversold reversal formations are far more likely to be true signals of a change in direction.
There are five basic principles of Stochastic oscillator interpretation:
- Tops & Bottoms
- Failure Swings
- Combining different time frames
Tops & Bottoms:
When an indicator reaches its extremes − the overbought or oversold zone − it is usually an indication of a possible trend reversal. In the case of the Stochastic oscillator, however, due to its unique construction, reaching the extremes of “0” or “100” percent indicates that the trend is very strong and will possibly continue higher/lower. Remember that when %K is at 100% it means that prices are at the peak of their range for the period under review and therefore this constitutes a very bullish sign.
The Stochastic is said to be in the overbought zone when reaching prices above 80 and oversold when below 20.
Although these extreme readings admit that things are a bit overdone, the trend may still have some way to go, so do not exit a position based on this fact alone unless there is a valid divergence, %K - %D line crossover or failure swing present as we will see further on.
Divergences: The major signal to watch is a divergence between the %D line and the price of the underlying market when the %D line is in an overbought or oversold area. A bearish divergence occurs when the %D line is over 80 and forms two declining peaks while prices continue to rise higher. A bullish divergence occurs when the %D line is under 20 and forms two rising bottoms while the prices continue lower.
Stochastic oscillator divergences are as noted the major signal to watch for, since in the majority of cases there are only one, or at the most two of them. That is, compared for example to the RSI, there are usually much fewer divergences displayed.
For an actual buy/sell signal it is nevertheless better to wait for a %K line - %D line crossover.
Crossovers: In most cases, the most sensitive %K line will cross the slower %D line before it has the chance to change direction itself. According to George Lane himself, the strongest stochastic signal comes when the %K line crosses from the right hand side of the %D line after %D changes direction.
Three consecutive right hand side %K - %D line crosses, leading to lower prices.
In a rising market, a bearish failure swing occurs in the overbought zone, as the price makes a low simultaneously with the %D line, but, as both series attempt to make a new higher high, %D only manages to form a lower high and then breaks below its previous low as the underlying instrument continues up-trending. A bullish failure swing is like a bearish failure swing happening upside-down in the oversold zone.
Combining different time frames: The oscillator can be used by arranging several Stochastics with different length and smoothing parameters on the same chart. The advantage is that since each one of them reflects different cyclic rhythms, the combination will reveal a specific technical pattern that one oscillator alone might have missed. Another advantage is that oscillators with longer length can help to determine market direction while oscillators with shorter length can assist with the trade’s timing. For the application of this principle, see example that follows.
The Stochastics oscillator can also provide information about future price moves by employing trendline analysis or by revealing chart patterns that might not be evident on the underlying prices chart.
Long Entry signal: Stochastic(5,3,3) < 20 and there is an apparent %K - %D line crossover and a positive divergence with the underlying instrument price, also confirmed by the longer period Stochastics employed with the Stochastic(10,10,5) also experiencing a positive divergence with the underlying instrument chart. Enter long when there is actual price confirmation of a higher high in prices.
Change of trend warning: Stochastic(5,3,3) > 80 and experiencing a negative divergence with the underlying instrument prices chart.
Long Exit signal: Following the apparent negative divergence with the underlying instrument chart, enter short when there is a %K - %D line crossover and an actual price confirmation of a lower low in prices and Stochastic(5,3,3) < 80. The longer-period Stochastics offer a delayed but solid confirmation of the reversal.
Tips and ideas
All signalling provided by the oscillator should always be interpreted while being aware of the direction of the main trend. Rallies in the direction of the prevailing trend are always stronger while corrections are usually weak or developed as consolidations.
In volatile market conditions, the Stochastic often reaches its extreme values of “0” or “100” and can not provide any value. In that case, smoothing the indicator offsets this problem, at the cost of introducing a bigger lag. The trader should calibrate the oscillator so as to come off the extreme reading that does not leave room for signal interpretation but also remain as responsive as possible.
During periods of strong trending markets when the Stochastic reaches its extremes of 0 or 100, the %K typically retreats 20-25% from its extreme, then rallying back towards it again. This is a rather confusing situation since it could be perceived as a change in trend. To avoid confusion, the trader should have a clear picture of the underlying trend direction and investigate using the principles illustrated above whether that is indeed a change in trend or a charge for even higher/lower levels.
Suggested Combinations for EA development
Relative Strength Index
Fibonacci retracement levels
Chart reversal patterns as sign of exhaustion.
Price - Moving Average crossover signals can be used for confirmation help.
Basic trend analysis can help distinguish strong crossover signals from weak crossover signals.
Use in FxPro Quant
The Stochastic oscillator can be found under the ‘Indicators’ group in our FxPro Quant menu. With FxPro Quant, we do not have to worry about the calculations and definitions behind the indicator. We just need to drag & drop the indicator in the main window and set the parameters we want to test.
Input: e.g. EURUSD, GBPYEN | Default: Current
If left empty, the instrument symbol used in the relevant chart in MT4 will relate by default.
Input:1m,5m,15m,30m,1h | Default: Current
If set to “current”, the time frame used in the relevant chart in MT4 will relate by default.
Input: number | Default: 5 periods
Number of periods used in the calculation formula to derive the %K-fast (see excel spread sheet attached).
Input: number | Default: 3 periods
Number of periods used for the smoothing calculation formula to derive the %D (see excel spread sheet attached).
Input: number | Default: 3 periods
Number of periods used for the smoothing of %K-fast to derive the %K. A value of 1 is considered a fast stochastic; a value of 3 is considered a slow stochastic (see excel spread sheet attached).
Input: Simple, Exponential, Smoothed, Linear Weighted | Default: Simple
Method used in the calculation of the Moving Average used for the smoothing of the lines.
Input: Low/High, Close/Close | Default: Low/High
Formula used to derive the indicator.
Low/High: 100 x (Recent Close-Lowest Low)/ (Highest High-Lowest Low)
Close/Close: 100 x (Recent Close-Lowest Close)/ (Highest Close - Lowest Close)
Input: Main Line (%K), Signal Line (%D) | Default: Main Line
Indicator value required for the Expert Advisor system in question.
Input: Number | Default: "0"
Selects the data used for calculating the Indicator (Number of periods back or forth).
Please note that ‘Bands Shift’=1 means shifting the Bands one period backwards (in the past).
Martin J. Pring – Momentum Explained
John J. Murphy – Technical Analysis of the Financial Markets
Perry J. Kaufman – Trading Systems and Methods