Download MetaTrader 5

Indicators: Stochastic Oscillator

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
182671
MetaQuotes Software Corp.  

Stochastic Oscillator:

The Stochastic Oscillator indicator compares where a security’s price closed relative to its price range over a given time period.

Stochastic Oscillator

Author: MetaQuotes Software Corp.

MQL4 Comments
16319
MQL4 Comments  
how does one smooth this like the dfault one in mt4 and how does one have it calculate from ... (H+L+O+C)/4 ... ?
Fab
4
Fab  

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]
  • stockcharts.com
Developed by George C. Lane in the late 1950s, the Stochastic Oscillator is a momentum indicator that shows the location of the close relative to the high-low range over a set number of periods. According to an interview with Lane, the Stochastic Oscillator “doesn't follow price, it doesn't follow volume or anything like that. It follows the...
To add comments, please log in or register