Stochastic Momentum by William Blau EA

Inputs

  • q – period of Stochastic Momentum (by default q=5);
  • r – period of the 1st EMA, applied to Stochastic Momentum (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).

Description

The q-period Stochastic Momentum is defined as a distance of the current close from the midpoint of q bars.

  • The value of Stochastic Momentum indicates the distance between the midpoint of q-period price range.
  • The sign of Stochastic Momentum indicates the price position relative to the midpoint of price range: the positive values if the price is higher than midpoint, the negative if the price is lower than midpoint of price range.

Calculation:

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

sm(price,q) = price – 1/2 * [LL(q) + HH(q)]

where:

  • price – close price;
  • q – number of bars, used in calculation of Stochastic Momentum;
  • LL(q) – minimal price (q bars);
  • HH(q) – maximal price (q bars);
  • 1/2*[LL(q)+HH(q)] – midpoint of the q-period price range.

The smoothed q-period Stochastic Momentum is calculated by formula:

SM(price,q,r,s,u) = EMA(EMA(EMA(sm(price,q),r),s),u)

where:

  • price – close price;
  • q – number of bars, used in calculation of Stochastic Momentum;
  • sm(price,q)=price-1/2*[LL(q)+HH(q)] – q-period Stochastic Momentum;
  • EMA(sm(price,q),r) – 1st smoothing- exponentially smoothed moving average with period r, applied to q-period Stochastic Momentum;
  • EMA(EMA(…,r),s) – 2nd smoothing – EMA of period s, applied to result of the 1st smoothing;
  • EMA(EMA(EMA(sm(q),r),s),u) – 3rd smoothing – EMA of period u, applied to result of the 2nd smoothing.