All indicators

OBV with Divergence

Apr 23, 2020

Static chart image
Volume BasedSignalsOscillatorsDivergences

The OBV with Divergence indicator provides a visual representation of volume-based momentum trends and automatically identifies price-to-oscillator divergences to highlight potential market reversals or trend continuations.

Usage

The tool is primarily used to identify momentum shifts through the On Balance Volume (OBV) Oscillator. By comparing the oscillator's peaks and valleys to price action, traders can spot four types of divergences:

  • Regular Bullish Divergence: Occurs when price makes a lower low while the OBV Oscillator makes a higher low, suggesting a potential bullish reversal.
  • Regular Bearish Divergence: Occurs when price makes a higher high while the OBV Oscillator makes a lower high, suggesting a potential bearish reversal.
  • Hidden Bullish Divergence: Occurs when price makes a higher low while the OBV Oscillator makes a lower low, indicating trend continuation.
  • Hidden Bearish Divergence: Occurs when price makes a lower high while the OBV Oscillator makes a higher high, indicating trend continuation.

The oscillator itself changes color based on its position relative to the zero line, providing a quick visual reference for volume momentum.

Details

This script combines two technical concepts: the OBV Oscillator and pivot-based divergence detection logic. The OBV Oscillator is calculated by taking the cumulative On Balance Volume and subtracting its Exponential Moving Average (EMA) of a user-defined length. This transforms the standard OBV into a centered oscillator, making it easier to identify cycle peaks and troughs. The divergence logic uses pivot points (lookback left and right) to locate significant structural points in both price and volume data.

Settings

  • Length: Determines the period for the EMA used to calculate the OBV Oscillator.
  • 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 confirmation.
  • Max of Lookback Range: The maximum number of bars allowed between two pivots for a divergence to be valid.
  • Min of Lookback Range: The minimum number of bars required between two pivots for a divergence to be valid.
  • Plot Bullish/Hidden Bullish: Toggles the visibility of bullish divergence labels and lines.
  • Plot Bearish/Hidden Bearish: Toggles the visibility of bearish divergence labels and lines.

FAQ

How can I access OBV with Divergence? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

What is the difference between regular and hidden divergence? Regular divergences signal a potential trend reversal, while hidden divergences typically suggest that the current trend is likely to continue.

Can I change the sensitivity of the divergence detection? Yes, by adjusting the Pivot Lookback Left and Right settings, you can make the indicator more sensitive to short-term fluctuations or more focused on long-term structural shifts.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.