Sorry,
but is the definition of slow %K not the SMA(Sk) of (fast) %K? (see f.i.: http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:stochastic_oscillator_fast_slow_and_full).
Now, the SMA over Sk periods of %K is SUM(%K1, %K2, ... %KSk) / Sk. Given for instance a Sk of 3 and a Pk of three (just to make the example short) this will be ((Close[0] - Min[0]) / (Max[0] - Min[0]) + (Close[1] - Min[1]) / (Max[1] - Min[1]) + (Close[3] - Min[3]) / (Max[3] - Min[3])) / 3.
If we want to simplify let's call
(Close[0] - Min[0]) = x
(Close[1] - Min[1]) = y
(Close[2] - Min[2]) = z
and
(Max[0] - Min[0]) = a
(Max[1] - Min[1]) = b
(Max[2] - Min[2]) = c.
Then the smoothing of %K through the SMA would be: 1/3 * (x/a + y/b + z/c) [§1].
It is surely NOT SUM (CLOSE - MIN (LOW, Pk), Sk) / SUM (MAX (HIGH, Pk) - MIN (LOW, Pk)), Sk)
In fact, using the formalism of above, this smoothing is:
(x + y + z) / (a + b + c) [§2].
If I am not wrong, [§1] = [§2] just in the particular case that a = b = c. Isn't it?
The difference in the two ways of smoothing is subtle, because the Lowest Low and the Highest High are calculated along a sliding window, and therefore the likelihood of being in the particular case (i.e. identical results for the two smoothing forms) is quite high. But, if you compare the MetaTrader stochastic with other platforms (or another algorithm in mql) then the differences can be seen.
Nice to hear criticisms and comments...
![Stochastic Oscillator [ChartSchool] Stochastic Oscillator [ChartSchool]](https://c.mql5.com/36/10/stochastic-oscillator-chartschool.png)
- stockcharts.com
The %D moving average is calculated according to the formula:
%D = SMA (%K, Pd)
where:
- Pd — is the smoothing period for %K;
- SMA — is the Simple Moving Average.
-----------------------------------------------------------------------
Where are the smoothing parameters in the code?
This indicator does not function as the default one in MT4, and it has less parameters.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Stochastic Oscillator:
The Stochastic Oscillator indicator compares where a security’s price closed relative to its price range over a given time period.
Author: MetaQuotes Software Corp.