Download MetaTrader 5

Watch how to download trading robots for free

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2011.06.24 13:02

Stochastic Indicator Blau_TStoch - indicator for MetaTrader 5

| English Русский 中文 Español Deutsch 日本語 Português

votes: 13

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


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

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

  • 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)


  • 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.

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).


  • 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).

Translated from Russian by MetaQuotes Software Corp.
Original code:

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

Average Directional Movement Index (ADX) Average Directional Movement Index (ADX)

The Average Directional Movement Index Indicator (ADX) helps to determine if there is a price trend.

Price Quote Price Quote

Displays current bid price and % change of (open price of) current bar or X previous bars, also High, Low, and range.

Auto Fibonacci Retracement Auto Fibonacci Retracement

Automatically draws Fibonacci retracements on chart.