On Balance Volume + Trend + Divergences
Mar 7, 2021

The On Balance Volume + Trend + Divergences indicator enhances the standard OBV calculation by integrating trend-based coloring and automated divergence detection to identify potential price reversals.
Usage
The tool can be used to identify trend direction and momentum shifts through the On Balance Volume (OBV) line. The line changes color based on its position relative to its 20-period Exponential Moving Average (EMA); a green line indicates bullish momentum (OBV > EMA), while a red line indicates bearish momentum (OBV < EMA).
Users can also monitor the chart for "Bull" or "Bear" labels, which signify regular divergences between price and volume flow. Regular bullish divergences occur when price makes a lower low while OBV makes a higher low, suggesting a potential upward reversal. Regular bearish divergences occur when price makes a higher high while OBV makes a lower high, suggesting a potential downward reversal. Hidden divergences can also be enabled to identify trend continuation opportunities.
Details
The script calculates cumulative volume based on price change direction (On Balance Volume). To provide better analytical depth, it applies a 20-period EMA to the OBV values to determine the short-term trend of volume flow. The divergence engine utilizes pivot points (defined by left and right lookback settings) to compare price peaks and valleys against the corresponding peaks and valleys in the OBV oscillator.
Settings
- Divergences: A toggle to assist in visual organization of the divergence settings.
- Pivot Lookback Right: The number of bars to the right of a pivot point required for confirmation.
- Pivot Lookback Left: The number of bars to the left of a pivot point required for identification.
- Max of Lookback Range: The maximum number of bars to look back when searching for a previous pivot to compare for divergence.
- Min of Lookback Range: The minimum number of bars to look back when searching for a previous pivot.
- Plot Bullish / Hidden Bullish: Toggles for the visibility of regular and hidden bullish divergence labels and lines.
- Plot Bearish / Hidden Bearish: Toggles for the visibility of regular and hidden bearish divergence labels and lines.
FAQ
How do I use the OBV color change?
The color change serves as a trend filter. When the OBV line turns green, it indicates that volume-weighted momentum is positive relative to its recent average. When it turns red, volume flow is predominantly negative.
What is the difference between Regular and Hidden Divergences?
Regular divergences typically signal a trend reversal, while hidden divergences often signal a trend continuation. You can enable Hidden Divergences in the settings menu.
How can I access On Balance Volume + Trend + Divergences?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.