Unlocking the Candlestick Momentum Indicator for MetaTrader 5

Mike 2011.07.12 00:22 27 0 0
Attachments

Author: Andrey N. Bolkonsky

The Candlestick Momentum Indicator (also known as the q-period Candlestick Momentum) is a powerful tool developed by William Blau. You can dive deeper into its mechanics in his book, "Momentum, Direction, and Divergence: Applying the Latest Momentum Indicators for Technical Analysis".

  • Ensure WilliamBlau.mqh is placed in terminal_data_folder\MQL5\Include\
  • Place Blau_CMtm.mq5 in terminal_data_folder\MQL5\Indicators\

At its core, momentum is the difference between the current price (like the closing price of a bar) and a price from a few bars back. This concept is versatile and can be applied across any timeframe.

As William Blau describes, Candlestick Momentum is defined as the price change over a fixed interval:

cmtm = close - open

Where:

  • close: the closing price of the bar (candle);
  • open: the opening price of the bar (candle).

The momentum can be either positive or negative. If the closing price is higher than the opening price, we have positive momentum. Conversely, if the opening price exceeds the closing price, it results in negative momentum.

The definition of Candlestick Momentum can be expanded to include:

  1. It can be applied to any timeframe.
  2. The prices used (closing price, opening price) can be adjusted as needed.

The definition of the q-period Candlestick Momentum

Understanding the q-period Candlestick Momentum

Candlestick Momentum Indicator by William Blau

Candlestick Momentum Indicator by William Blau

Calculation:

The formula for calculating Candlestick Momentum is:

cmtm(price1,price2,q) = price1 - price2[q-1]

Where:

  • q: the number of bars used in the calculation of Candlestick Momentum;
  • price1: the closing price;
  • price2[q–1]: the opening price from q bars ago.

The smoothed q-period Candlestick Momentum is calculated using the following formula:

CMtm(price1,price2,q,r,s,u) = EMA(EMA(EMA( cmtm(price1,price2,q) ,r),s),u)

Where:

  • q: the number of bars for Candlestick Momentum;
  • price1: the closing price;
  • price2: the opening price from q bars ago;
  • cmtm(price1,price2,q): the basic q-period Candlestick Momentum;
  • EMA(cmtm(price1,price2,q),r): 1st smoothing using EMA (r) on the q-period Candlestick Momentum;
  • EMA(EMA(...,r),s): 2nd smoothing using EMA(s) on the result of the 1st smoothing;
  • EMA(EMA(EMA(...,r),s),u): 3rd smoothing using EMA(u) on the result of the 2nd smoothing.

Input parameters:

  • q: the period for the Candlestick Momentum Indicator (default q=1);
  • r: the period of the 1st EMA (default r=20);
  • s: the period of the 2nd EMA (default s=5);
  • u: the period of the 3rd EMA (default u=3);
  • AppliedPrice1: price type (default AppliedPrice=PRICE_CLOSE);
  • AppliedPrice2: price type (default AppliedPrice=PRICE_OPEN).

Note:

  • q must be greater than 0;
  • r, s, and u must be greater than 0. If any of these values are equal to 1, smoothing will not be applied;
  • Minimum rates = (q-1+r+s+u-3+1).
List
Comments 0