Stochastics measures the relative position of a closing price within a certain range. You can have a regular stochastic, or a slow stochastic. The calculation is performed as follows:
Assume a 5 bar stochastic.
For the last four bars and the current bar, find the highest high and the lowest low of the bars.
The calculation for the regular stochastic %K:
100 * ((the close of the current bar - the lowest low) / (the highest high - the lowest low))
The calculation for the regular stochastic %D, which is the same thing as the slow %K:
(regular stochastic %K for the current bar + regular stochastic %K for the previous bar + regular stochastic %K for two bars ago) / 3
The calculation for the slow stochastic %D:
(regular stochastic %D for the current bar + regular stochastic %D for the previous bar + regular stochastic %D for two bars ago) / 3
Reference: None.