Author: Andrey N. Bolkonsky
The Stochastic Oscillator is a powerful tool based on the Stochastic Index developed by William Blau. If you're looking to deepen your trading strategies, you might want to check out his work in Momentum, Direction, and Divergence.
- To use this indicator, make sure to place WilliamBlau.mqh in your terminal_data_folder\MQL5\Include\ directory.
- Additionally, Blau_TS_Stochastic.mq5 needs to go in your terminal_data_folder\MQL5\Indicators\ folder.

Stochastic Oscillator by William Blau
How It's Calculated:
The Stochastic Oscillator is calculated as follows:
TS_Stochastic(price,q,r,s,u) = TStochI(price,q,r,s,u)
The Signal line is determined through smoothing:
SignalLine(price,q,r,s,u,ul) = EMA(TS_Stochastic(price,q,r,s,u) ,ul)
- TS_Stochastic() - This represents the Fast Stochastic, %k - Stochastic Index TStochI(price,q,r,s,u);
- SignalLine() - This is the Slow Stochastic (the Signal Line), %d, which is an exponentially smoothed moving average applied to the Fast Stochastic (%k) with a period of ul;
- ul - This is the EMA smoothing period for the Signal Line.
Input Parameters:
- Graphic Plot #0 - Fast Stochastic (Stochastic Index), %k:
- q - This is the period of Stochastic (default is q=5);
- r - This is the period of the 1st EMA applied to Stochastic (default is r=20);
- s - This is the period of the 2nd EMA smoothing applied to the result of the 1st smoothing (default is s=5);
- u - This is the period of the 3rd EMA smoothing applied to the result of the 2nd smoothing (default is u=3);
- Graphic Plot #1 - Slow Stochastic (Signal Line), %d:
- ul - This is the period of EMA smoothing (signal line) applied to Fast Stochastic (default is ul=3);
- AppliedPrice - This refers to the type of price applied (default is AppliedPrice=PRICE_CLOSE).
Important Notes:
- q must be greater than 0;
- r, s, and u must also be greater than 0. If r, s, or u = 1, smoothing is not applied;
- ul must be greater than 0. If ul = 1, the oscillator and signal lines will be identical;
- Minimum rates = (q-1 + r + s + u - 3 + 1).

Comments 0