Tick Volume Indicator v2
Author:MaryJane (2011.12.19 12:19)
mq435 Tick Volume Indicator v2 TVI_v2.mq4 (8.5 Kb) View

History and formula:

The Tick Volume Indicator was invented by William Blau and has been published in his book “Momentum, Direction and Divergence” (1995, page 43).

The indicator starts with separating the upticks and downticks in each price bar. The resulting arrays are smoothed with DEMA (two-pass EMA with periods r and s subsequently). The raw TVI is calculated with the following formula:

DEMA(upticks) – DEMA(downticks)

TVI_Raw = 100 * ———————————

DEMA(upticks) + DEMA(downticks)

… and the final TVI shape is made by additional EMA smoothing with a period of u.


Besides using TVI for divergence, I have found the change of TVI slope to be a very useful and precise proxy for change in price direction, especially in periods of high volatility in short timeframes.

Other MQL4 versions:

The indicator was implemented in MQL4 by Profitrader many years ago, using all available buffers for calculations and plotting a single line. I have found a few colored histogram versions across the Net, all of them called the tvi.mq4 via iCustom() and all repaint because of poor coding. So I decided to make myself a proper stand-alone histogram variant. 7 native buffers and 6 extra buffers (via arrays) are used. It will never repaint.

TVI Tick Volume Indicator v2


  • r, s and u are the smoothing periods (see above). Try 21/21/8 for slower mode.
  • To hide the histogram and only use the line, set colors 1-4 to None.
  • To hide the line and only use the histogram, set color 5 to None.
  • BarCount is necessary for array dimensioning and shifting (done once per bar).
  • If you need to see more history, increase BarCount (default = 500).
  • Alerts (if allowed) will be made on specified AlertCandle (0=current, 1=last closed, 2=previous closed, ect).
  • For sending alerts per email, specify the AlertEmailSubject.