Stochastic oscillator is a momentum indicator within technical analysis that uses support and resistance levels as an oscillator. George Lane developed this indicator in the late 1950s. The term stochastic refers to the point of a current price in relation to its price range over a period of time. This method attempts to predict price turning points by comparing the closing price of a security to its price range. The 5-period stochastic oscillator in a daily timeframe is defined as follows:
% K = 100 × P r i c e − L o w 5 H i g h 5 − L o w 5 {\displaystyle \%K=100\times {\frac {\mathrm {Price} -\mathrm {Low} _{5}}{\mathrm {High} _{5}-\mathrm {Low} _{5}}}}
% D N = % K 1 + % K 2 + % K 3 + . . . % K N N {\displaystyle \%D_{N}={\frac {\%K_{1}+\%K_{2}+\%K_{3}+...\%K_{N}}{N}}}
where H i g h 5 {\displaystyle \mathrm {High} _{5}} and L o w 5 {\displaystyle \mathrm {Low} _{5}} are the highest and lowest prices in the last 5 days respectively, while %D is the N-day moving average of %K (the last N values of %K). Usually this is a simple moving average, but can be an exponential moving average for a less standardized weighting for more recent values. There is only one valid signal in working with %D alone — a divergence between %D and the analyzed security.
Calculation The calculation above finds the range between an asset's high and low price during a given period of time. The current security's price is then expressed as a percentage of this range with 0% indicating the bottom of the range and 100% indicating the upper limits of the range over the time period covered. The idea behind this indicator is that prices tend to close near the extremes of the recent range before turning points. The Stochastic oscillator is calculated:
% K = P r i c e − L o w N H i g h N − L o w N × 100 {\displaystyle \%K={\frac {\mathrm {Price} -\mathrm {Low} _{N}}{\mathrm {High} _{N}-\mathrm {Low} _{N}}}\times 100}
% D = % K 1 + % K 2 + % K 3 3 {\displaystyle \%D={\frac {\%K_{1}+\%K_{2}+\%K_{3}}{3}}}
Where
P r i c e {\displaystyle \mathrm {Price} } is the last closing price
L o w N {\displaystyle \mathrm {Low} _{N}} is the lowest price over the last N periods
H i g h N {\displaystyle \mathrm {High} _{N}} is the highest price over the last N periods
% D {\displaystyle \%D} is a 3-period simple moving average of %K, S M A 3 ( % K ) {\displaystyle \mathrm {SMA} _{3}(\%K)} .
… excerpt ends here. Continue reading the full article.

