Understanding the Stochastic Index: A Deep Dive into Blau_TStochI for MetaTrader 5

Mike 2011.06.24 22:56 47 0 0
Attachments

Author: Andrey N. Bolkonsky

The Stochastic Index, a normalized smoothed q-period Stochastic developed by William Blau, is detailed in his book Momentum, Direction, and Divergence: Applying the Latest Momentum Indicators for Technical Analysis.

This indicator normalizes the values of the q-period smoothed Stochastic, mapping them into a range between [0, +100]. This makes it an effective tool for identifying overbought or oversold conditions in the market.

  • Make sure to place WilliamBlau.mqh in your terminal_data_folder\MQL5\Include\
  • Place Blau_TStochI.mq5 in your terminal_data_folder\MQL5\Indicators\

Stochastic Index Indicator by William Blau

Stochastic Index Indicator by William Blau

Calculation:

The Stochastic Index Indicator is calculated using the following formula:

100 * EMA(EMA(EMA( price-LL(q) ,r),s),u)
TStochI(price,q,r,s,u) = -------------------------------------------------
100 * TStoch(price,q,r,s,u)
EMA(EMA(EMA( HH(q)-LL(q) ,r),s),u)

Where:

  • price - close price;
  • q - number of bars used in the calculation;
  • LL(q) - lowest price over the q bars;
  • HH(q) - highest price over the q bars;
  • stoch(q)=price-LL(q) - q-period Stochastic;
  • TStoch(price,q,r,s,u) - triple smoothed q-period Stochastic;
  • HH(q)-LL(q) - q-period price range;
  • EMA(...,r) - first smoothing using the exponentially smoothed moving average with period r, applied to:
    1. q-period Stochastic;
    2. q-period Price Range;
  • EMA(EMA(...,r),s) - 2nd smoothing: EMA of period s applied to the result of the 1st smoothing;
  • EMA(EMA(EMA(...,r),s),u) - 3rd smoothing: EMA of period u applied to the result of the 2nd smoothing.

If EMA(EMA(EMA(HH(q)-LL(q),r),s),u)=0, then TStochI(price,q,r,s,u)=0.

Input Parameters:

  • q - period used for the calculation of Stochastic (default is q=5);
  • r - period of the 1st EMA applied to Stochastic (default is r=20);
  • s - period of the 2nd EMA applied to the result of the 1st smoothing (default is s=5);
  • u - period of the 3rd EMA applied to the result of the 2nd smoothing (default is u=3);
  • AppliedPrice - price type (default is AppliedPrice=PRICE_CLOSE).

Note:

  • q>0;
  • r>0, s>0, u>0. If r, s, or u =1, smoothing is not applied;
  • Minimum rates = (q-1+r+s+u-3+1).
List
Comments 0