Stochastic Oscillator
The Stochastic Oscillator compares a market instrument's closing price to its price range over a period of time. It consists of two lines:
- %K is the main line – displayed as a solid line
- %D is the moving average over a number of time periods – displayed as a dotted line
The Stochastic Oscillator can be used in several ways:
- Buy when the %K or the %D line falls below a specific level such as 20% and then rises
- Sell when the %K or the %D line rises above a specific level such as 80% and then falls
- Buy when the %K line rises above the %D line
- Sell when the %K line falls below the %D line
- Look for divergences such as when prices are making new highs and the indicator isn't
Calculation
The raw Stochastic Oscillator is calculated by taking the difference of the current close and low prices, and dividing this by the trading range over a number of periods.
SO( J ) = ( CLOSE( J )- LOW ( P ) ) / ( HIGHEST( P ) - LOWEST( P ) ) * 100
HIGHEST( P ) is the highest high in P periods
LOWEST( P ) is the lowest low in P periods
The K% line is then calculated by taking the moving average over a number of periods; one period is considered a fast stochastic, and three periods is a slow stochastic.
%K( J ) = MA( SO( J ), Q, T )
Q is the number of periods used for smoothing
T is the type of moving average – simple, smoothed, exponential or weighted
The D% line is then calculated as the simple moving average of %K.
%D = SMA( %K, R )
Q is the number of periods used for the simple moving average
Therefore, there are four parameters to the Stochastic Oscillator:
- P – the number of periods in the highest high/lowest low sliding window
- Q – the number of periods used to smooth the %K line
- R – the number of periods used to smooth the %D line
- T – the type of moving average used to smooth the %K line
You can find more information about technical indicators in the MetaTrader 4 User Guide. Select Help > Help Topics > Analytics > Technical Indicators.
