OPEN-SOURCE SCRIPT

Directional Volume Index

Directional Volume Index (DVI) (buying/selling pressure)

This index is adapted from the Directional Movement Index (DMI), but based on volume instead of price movements. The idea is to detect building directional volume indicating a growing amount of orders that will eventually cause the price to follow. (DVI is not displayed by default)

The rough algorithm for the Positive Directional Volume Index (green bar):
  1. calculate the delta to the previous green bar's volume
  2. if the delta is positive (growing buying pressure) add it to an SMA, else add 0 (also for red bars)
  3. divide these average deltas by the average volume
  4. the result is the Positive Directional Volume Index (DVI+) (vice versa for DVI-)


Differential Directional Volume Index (DDVI) (relative pressure)

Creating the difference of both Directional Volume Indexes (DVI+ - DVI-) creates the Differential Directional Volume Index (DDVI) with rising values indicating a growing buying pressure, falling values a growing selling pressure. (DDVI is displayed by default, smoothed by a custom moving average)

Average Directional Volume Index (ADVX) (pressure strength)

Putting the relative pressure (DDVI) in relation to the total pressure (DVI+ + DVI-) we can determine the strength and duration of the currently building volume change / trend. For the DMI/ADX usually 20 is an indicator for a strong trend, values above 50 suggesting exhaustion and approaching reversals. (ADVX is not displayed by default, smoothed by a custom moving average)

Divergences of the Differential Directional Volume Index (DDVI) (imbalances)

By detecting divergences we can detect situations where e.g. bullish volume starts to build while price is in a downtrend, suggesting that there is growing buying pressure indicating an imminent bullish pullback/order block or reversal. (strong and hidden divergences are displayed by default)

Divergences Overview:
  • strong bull: higher lows on volume, lower lows on price
  • medium bull: higher lows on volume, equal lows on price
  • weak bull: equal lows on volume, lower lows on price
  • hidden bull: lower lows on volume, higher lows on price
  • strong bear: lower highs on volume, higher highs on price
  • medium bear: lower highs on volume, equal highs on price
  • weak bear: equal highs on volume, higher highs on price
  • hidden bear: higher highs on volume, lower highs on price


DDVI Bands (dynamic overbought/oversold levels)

Using Bollinger Bands with DDVI as source we receive an averaged relative pressure with stdev band offsets. This can be used as dynamic overbought/oversold levels indicating reversals on sharp crossovers.

Alerts

As of now there are no alerts built in, but all internal data is exposed via plot and plotshape functions, so it can be used for custom crossover conditions in the alert dialog. This is still a personal research project, so if you find good setups, please let me know.
Bands and ChannelsCentered OscillatorsvolumeanalysisvolumeindexvolumeindicatorVolume

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?

Aviso legal