Stochastic Indicator Blau_TStoch – indicator MetaTrader 5

Author: Andrey N. Bolkonsky

Stochastic Indicator (smoothed q-period Stochastic) by William Blau is based on Stochastic Indicator (see Momentum, Direction, and Divergence: Applying the Latest Momentum Indicators for Technical Analysis).

It shows the distance between the close price and lowest price of the q bars. The numerical value of Stochastic shows the price position relative to the lowest price of the period (q bars), the values are >=0.

Stochastic Indicator Blau_TStoch

  • WilliamBlau.mqh must be placed in terminal_data_folder\MQL5\Include\
  • Blau_TStoch.mq5 must be placed in terminal_data_folder\MQL5\Indicators\

Stochastic Indicator Blau_TStoch

Stochastic Indicator Blau_TStoch

Calculation:

The following formula is used for the calculation of q-period Stochastic:

stoch(price,q) = price – LL(q)

where:
  • price – close price of the current timeframe;
  • q – number of bars, used in calcualtion of Stochastic;
  • LL(q) – lowest price of the q bars.

The smoothed q-period stochastic is calculated as follows:

TStoch(price,q,r,s,u) = EMA(EMA(EMA( stoch(price,q) ,r),s),u)

where:

  • price – close price;
  • q – number of bars, used in calcualtion of Stochastic;
  • stoch(price,q)=price-LL(q)- q-period Stochastic;
  • EMA(stoch(price,q),r) – 1st smoothing- exponentially smoothed moving average with period r, applied to Stochastic;
  • EMA(EMA(…,r),s) – 2nd smoothing – EMA of period s, applied to result of the 1st smoothing;
  • EMA(EMA(EMA(…,r),s),u) – 3rd smoothing – EMA of period u, applied to result of the 2nd smoothing.
Alternative:   MQL Plus Enhanced Debugging Support - library MetaTrader 5

Input parameters:

  • q – period, used for the calculation 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, applied to result of the 1st smoothing (by default s=5);
  • u – period of the 3rd EMA, applied to result of the 2nd smoothing (by default u=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;
  • Min. rates =(q-1+r+s+u-3+1).


📈 ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks