OBV with Volume/Momentum Divergence
Jul 7, 2022

The OBV with Volume/Momentum Divergence indicator provides a comprehensive approach to trend reversal detection by combining On-Balance Volume (OBV) with momentum oscillators like RSI and MACD. It identifies regular and hidden divergences across volume and momentum data to filter out false signals and highlight high-probability setups.
Usage
The indicator plots an OBV oscillator and identifies various levels of divergence between the price and the oscillator data. These divergences are categorized and visually represented by different line colors to help traders gauge the strength of a potential reversal:
- Strong Divergence (Volume + RSI + MACD): Shown in dark green/red, this indicates that price action is contradicted by volume and two different momentum metrics.
- Moderate Divergence (Volume + RSI or Volume + MACD): Shown in light green/red, indicating a confluence between volume and one momentum metric.
- Standard Divergence (Volume Only): Shown in gray, representing a standard OBV divergence.
The Timeframe Scaling feature is particularly useful for traders who switch between timeframes frequently. When enabled, it adjusts the OBV oscillator's values to ensure the visual amplitude remains consistent, preventing the indicator from becoming "squashed" or "blown out" when moving from a 5-minute chart to a daily chart.
Details
The script is based on the original concepts by vyperphi696 and LazyBear but expands upon them by integrating Momentum (RSI and MACD Histogram) into the divergence logic. The indicator calculates divergences by detecting pivot highs and lows in the OBV oscillator and comparing them to price pivots within a specific lookback range.
The inclusion of momentum filters aims to improve the "signal-to-noise" ratio. For example, a bullish divergence on OBV is considered stronger if the RSI and MACD are also making higher lows while the price makes a lower low.
Settings
- OBV Length: Sets the period for the EMA subtraction used to create the OBV oscillator.
- RSI Length: Determines the period used for the Relative Strength Index momentum check.
- MACD Settings (Fast/Slow/Signal): Configures the parameters for the MACD Histogram calculation.
- Pivot Lookback (Right/Left): Defines the number of bars required on either side of a point to confirm a pivot high or low.
- Lookback Range (Max/Min): Sets the window of bars within which the script searches for a previous pivot to compare for divergence.
- Timeframe Scaling: A toggle to normalize indicator scaling across different timeframes for a smoother visual experience.
FAQ
How do I interpret the different line colors? The colors represent the "confluence" of the divergence. Darker colors represent a triple confluence of Volume, RSI, and MACD. Lighter colors indicate Volume plus one momentum oscillator, and gray indicates a standard Volume-only divergence.
What is the difference between regular and hidden divergence in this tool? Regular divergence typically indicates a potential trend reversal, while hidden divergence often suggests a trend continuation. Both can be toggled or viewed via the plot shapes and lines.
How can I access this script? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.
Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.
Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.
As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.
Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.
Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.
This does not represent our full Disclaimer. Please read our full disclaimer.
© 2026 LuxAlgo Global, LLC.

