Author: Andrey N. Bolkonsky
Stochastic Oscillator is based on Stochastic Index by William Blau (see Momentum, Direction, and Divergence: Applying the Latest Momentum Indicators for Technical Analysis).
- WilliamBlau.mqh must be placed in terminal_data_folder\MQL5\Include\
- Blau_TS_Stochastic.mq5 must be placed in terminal_data_folder\MQL5\Indicators\
Stochastic Oscillator by William Blau
Calculation:
Stochastic Oscillator is defined as follows:
TS_Stochastic(price,q,r,s,u) = TStochI(price,q,r,s,u)
Signal line is calculated using the smoothing:
SignalLine(price,q,r,s,u,ul) = EMA(TS_Stochastic(price,q,r,s,u) ,ul)
- TS_Stochastic() – Fast Stochastic, %k – Stochastic Index TStochI(price,q,r,s,u);
- SignalLine() – Slow Stochastic (Signal Line), %dΒ exponentially smoothed moving average with period ul, applied to Fast Stochastic (%k);
- ul – EMA smoothing period of a Signal Line.
Input parameters:
- graphic plot #0 – Fast Stochastic (Stochastic Index), %k:
- q – period of Stochastic (by default q=5);
- r – period of the 1st EMA, applied to Stochastic (by default r=20);
- s – period of the 2nd EMA smoothing, applied to result of the 1st smoothing (by default s=5);
- u – period of the 3rd EMA smoothing, applied to result of the 2nd smoothing (by default u=3);
- graphic plot #1 – Slow Stochastic (Signal Line), %d:
- ul – period of EMA smoothing (signal line), applied to Fast Stochastic (by default ul=3);
- AppliedPrice – price type (by default AppliedPrice=PRICE_CLOSE).
Note:
- q>0;
- r>0, s>0, u>0.If r, s or u =1, smoothing is not used;
- ul>0. If ul=1, the oscillator and signal lines are the same;
- Min. rates =(q-1+r+s+u-3+1).