MADALGO`s Enhanced OBV Divergences

MADALGO's Enhanced OBV Divergences indicator is a unique tool designed for traders to visualize the divergences between price action and On Balance Volume (OBV), a fundamental aspect often indicative of underlying strength or weakness in the market. By keenly identifying these divergences, traders are better positioned to anticipate potential trend reversals or trend continuations, making this script an invaluable addition to their technical analysis toolkit.

This script meticulously scans for both regular and hidden bullish/bearish divergences, providing a comprehensive view of market sentiment. The core of this indicator is built around the OBV, which cumulatively adds or subtracts volume based on the price movement per period, thus providing a running total of volume and portraying the force behind the price movements.

The regular divergences are classic indicators of a potential reversal in the current trend, while hidden divergences are often indicative of trend continuation. These divergences are pinpointed based on the relative positions of the OBV and price highs/lows, over customizable lookback periods and within specified lookback ranges.


  • Regular and Hidden Divergences: Clearly marked bullish and bearish divergences provide insights into potential market turning points.
  • On Balance Volume (OBV) Line: Visualize the continuous flow of buying and selling pressure, enabling the identification of accumulation or distribution phases essential for understanding the market's strength or weakness.
  • Moving Average of OBV: An optional feature to smooth the OBV line, aiding in the identification of the overarching trend.
  • Dynamic Statistics Label: A floating label provides real-time updates on essential statistics like the Rate of Percentage Change (RPC) of OBV, the last divergences, and bars since the last divergences.

  • Pivot Lookback Right and Pivot Lookback Left: Define the lookback periods for identifying pivot points in the OBV line.
  • Max of Lookback Range and Min of Lookback Range: Define the range for considering divergences.
  • RPC Period: Defines the period for calculating the Rate of Percentage Change of the OBV.
  • MA Period: Defines the period for the optional moving average of the OBV.
  • Plot Bullish, Plot Hidden Bullish, Plot Bearish, Plot Hidden Bearish: Toggle visibility of respective divergences.
  • Plot Moving Average: Toggle visibility of the OBV moving average.


  1. Add the script to your TradingView chart.
  2. Tailor the input parameters in the settings panel to align with your analysis requirements.
  3. The divergences, OBV line, and optional moving average will be plotted on your chart, with a dynamic label displaying real-time statistics.
  4. Set up alerts to be notified of identified divergences, enabling timely decision-making.

  • Regular bullish/bearish divergence in OBV found: Triggered when a regular bullish or bearish divergence is identified.
  • Hidden bullish/bearish divergence in OBV found: Triggered when a hidden bullish or bearish divergence is identified.

Underlying Concepts:

The OBV Divergences indicator is rooted in the principle that volume precedes price movement. When prices are rising with increased volume, it suggests that buying pressure is prevailing and may lead to continued upward momentum. Conversely, rising prices with decreasing volume might indicate a lack of buying conviction and could signal a potential price reversal. The identification of divergences between price and OBV can therefore serve as a powerful signal for traders. These examples can be seen below in the image

The Moving Average of the OBV further aids in understanding the prevailing trend by smoothing out the OBV line, providing a clearer picture of the market's longer-term momentum. The Rate of Percentage Change (RPC) provides insight into the momentum of volume, offering an additional layer of analysis. Together, these additional features enhance the core OBV analysis, enabling a more nuanced understanding of volume dynamics fundamental for making more informed trading decisions.


This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, you can obtain one at Mozilla Public License 2.0.

Get Access to MADALGO indicators:

Join our community:

All scripts & content provided by MADALGO are for informational & educational purposes only. Past performance does not guarantee future results.
Script de código abierto

Siguiendo el verdadero espíritu de TradingView, el autor de este script lo ha publicado en código abierto, para que los traders puedan entenderlo y verificarlo. ¡Un hurra por el autor! Puede utilizarlo de forma gratuita, aunque si vuelve a utilizar este código en una publicación, debe cumplir con lo establecido en las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.

¿Quiere utilizar este script en un gráfico?