A Stochastic Oscillator is a momentum indicator comparing a particular closing price of an asset to a range of its prices over a certain period of time. The sensitivity of the oscillator to market movements is reducible by adjusting that time period or by taking a moving average of the result. It is used to generate overbought and oversold trading signals, utilizing a range of values from 0-100.
The general theory serving as the foundation for this indicator is that in a market trending upward, prices will close near the high, and in a market trending downward, prices close near the low.
The stochastic oscillator is rangebound, meaning it is always between 0 and 100. This makes it a useful indicator of overbought and oversold conditions. Traditionally, readings over 80 are considered in the overbought range, while readings under 20 are considered oversold. However, these are not always indicative of impending reversal; very strong trends can maintain overbought or oversold conditions for an extended period. Instead, traders should look to changes in the oscillator for clues about future trend shifts.
Stochastics can be broken down into two lines; %K and %D:
%K = SMA(100 * (Current Close - Lowest Low) / (Highest High - Lowest Low), smoothK)
%D = SMA(%K, periodD)
%K = percentage of price at closing (K) within the price range of the number of bars used in the set period
%D = a smoothed average of %K
Lowest Low = The lowest price within the number of recent bars in the lookback period (periodK input)
Highest High = The highest price within the number of recent bars in the lookback period (periodK input)