OBV (On-Balance Volume) Trading Signals: TradingView Guide
OBV trading signals for TradingView. Volume divergence, trend confirmation, and breakout signals with Pine Script code and real examples from NQ and BTC.
OBV Signal Interpretation
Quick-reference guide to 7 signal types you will see on the chart.
| Signal Type | Indicator Condition | Market Meaning | Reliability |
|---|---|---|---|
| OBV Bullish Divergence | Price makes a lower low while OBV makes a higher low | Volume is accumulating during a price decline. Selling pressure is weakening. Smart money is buying the dip. This is one of the most reliable reversal signals. On NQ, I have seen this predict trend reversals 2 to 5 bars before price turns. | 5/5 |
| OBV Bearish Divergence | Price makes a higher high while OBV makes a lower high | Volume is declining during a price advance. Buying pressure is fading. Smart money is distributing shares. This signal warns of an approaching top. On BTC, bearish divergence on the 4H chart signaled the December 2024 peak. | 5/5 |
| OBV Trend Confirmation (Buy) | Price and OBV both making higher highs and higher lows | Volume confirms the uptrend. The move has broad participation. Trend continuation is the high probability outcome. This is when you add to winning positions with confidence. | 4/5 |
| OBV Trend Confirmation (Sell) | Price and OBV both making lower highs and lower lows | Volume confirms the downtrend. Sellers are in control with each leg. Avoid buying against this setup. Short positions or staying in cash are the right responses. | 4/5 |
| OBV Breakout Confirmation | Price breaks a resistance level and OBV breaks its corresponding resistance simultaneously | The breakout has genuine volume behind it. Fakeouts are much less likely when OBV confirms the price move. I take entries immediately on this setup rather than waiting for a pullback. | 4/5 |
| OBV Hidden Bullish Divergence | Price makes a higher low while OBV makes a lower low | The pullback in an uptrend is on declining volume. The trend is healthy and likely to resume. This signal works best on daily and 4H charts for trend continuation entries. | 3/5 |
| OBV Steady Upward Slope (Accumulation) | OBV trends steadily upward while price stays in a range | Smart money is accumulating positions during a quiet consolidation. This often precedes a large directional move. I look for this pattern on SPY daily charts before major breakouts. | 3/5 |
OBV Pine Script Signal Code
Ready-to-use Pine Script code for generating buy/sell signals. Copy and paste into your TradingView Pine Editor.
//@version=5
indicator("OBV Trading Signals", overlay=false, max_labels_count=50)
// === Inputs ===
useVolume = input.bool(true, "Use Tick Volume", tooltip="Uncheck for real volume on futures")
smoothLength = input.int(14, "OBV Smoothing (SMA)", minval=1, maxval=50)
divLookback = input.int(20, "Divergence Lookback", minval=10, maxval=100)
signalThreshold = input.float(0.5, "Divergence Threshold %", minval=0.1, maxval=5.0, step=0.1)
showDivergence = input.bool(true, "Show Divergence Labels")
// === OBV Calculation ===
rawObv = ta.obv
obvSmooth = ta.sma(rawObv, smoothLength)
// === Swing Points for Divergence ===
// Find recent swing highs and lows on price and OBV
float priceHigh = ta.highest(high, divLookback)
float priceLow = ta.lowest(low, divLookback)
float obvHigh = ta.highest(obvSmooth, divLookback)
float obvLow = ta.lowest(obvSmooth, divLookback)
// === Divergence Detection ===
// Bullish divergence: price lower low, OBV higher low
bullDiv = priceLow < priceLow[1] and obvLow > obvLow[1]
// Bearish divergence: price higher high, OBV lower high
bearDiv = priceHigh > priceHigh[1] and obvHigh < obvHigh[1]
// Hidden bullish divergence: price higher low, OBV lower low
hiddenBullDiv = priceLow > priceLow[1] and obvLow < obvLow[1]
// Hidden bearish divergence: price lower high, OBV higher high
hiddenBearDiv = priceHigh < priceHigh[1] and obvHigh > obvHigh[1]
// === Trend Confirmation ===
ema50 = ta.ema(close, 50)
ema200 = ta.ema(close, 200)
uptrend = close > ema50 and obvSmooth > obvSmooth[1]
downtrend = close < ema50 and obvSmooth < obvSmooth[1]
// === Breakout Confirmation ===
isBreakout = close > ta.highest(close, 20) * 0.985
obvBreakout = obvSmooth > ta.highest(obvSmooth, 20) * 0.985
confirmedBreakout = isBreakout and obvBreakout
// === Accumulation ===
isRanging = ta.stdev(close, 20) / ta.sma(close, 20) < 0.02
obvAccumulating = ta.sma(obvSmooth, 5) > ta.sma(obvSmooth, 20)
accumulationPhase = isRanging and obvAccumulating
// === Plotting ===
plot(rawObv, "Raw OBV", color=#9E9E9E, linewidth=1, style=plot.style_line)
plot(obvSmooth, "Smoothed OBV", color=#2962FF, linewidth=2)
hline(0, "Zero Line", color=#757575, linestyle=hline.style_dashed)
// Divergence Labels
plotshape(showDivergence and bullDiv, "Bullish Div", shape.labelup, location.bottom, color=color.new(#4CAF50, 30), text="BULL DIV", textcolor=#4CAF50, size=size.tiny)
plotshape(showDivergence and bearDiv, "Bearish Div", shape.labeldown, location.top, color=color.new(#FF5252, 30), text="BEAR DIV", textcolor=#FF5252, size=size.tiny)
plotshape(showDivergence and hiddenBullDiv, "Hidden Bull Div", shape.labelup, location.bottom, color=color.new(#26A69A, 30), text="H BULL", textcolor=#26A69A, size=size.tiny)
plotshape(showDivergence and hiddenBearDiv, "Hidden Bear Div", shape.labeldown, location.top, color=color.new(#EF5350, 30), text="H BEAR", textcolor=#EF5350, size=size.tiny)
// Confirmation and Breakout Labels
plotshape(confirmedBreakout, "Confirmed Breakout", shape.labelup, location.bottom, color=color.new(#7C4DFF, 30), text="B/O CONFIRM", textcolor=#7C4DFF, size=size.tiny)
plotshape(accumulationPhase, "Accumulation", shape.labelup, location.belowbar, color=color.new(#FFA000, 30), text="ACCUM", textcolor=#FFA000, size=size.tiny)
// Colored background zones
bgcolor(uptrend ? color.new(color.green, 90) : na, title="Uptrend BG")
bgcolor(downtrend ? color.new(color.red, 90) : na, title="Downtrend BG")
// === Alerts ===
alertcondition(bullDiv, "OBV Bullish Divergence", "Price lower low with OBV higher low - bullish divergence detected")
alertcondition(bearDiv, "OBV Bearish Divergence", "Price higher high with OBV lower high - bearish divergence detected")
alertcondition(confirmedBreakout, "OBV Confirmed Breakout", "Price breakout confirmed by OBV breakout")
alertcondition(accumulationPhase, "OBV Accumulation", "Price ranging with OBV trending up - accumulation phase")
alertcondition(hiddenBullDiv, "OBV Hidden Bullish Divergence", "Pullback on low volume - trend likely to resume up")Recommended Parameters for OBV
Parameter settings tested across different market conditions and timeframes.
| Parameter | Default | Description |
|---|---|---|
| Use Tick Volume | true | Toggles between tick volume and real volume data. Keep enabled for crypto and forex where only tick volume is available. Disable for futures if your broker provides real volume. On ES, real volume gives cleaner OBV divergences than tick volume. |
| OBV Smoothing (SMA) | 14 | The SMA period applied to the raw OBV line. Without smoothing, OBV looks like a noisy sawtooth. A value of 14 works well on 1H charts. On daily charts I use 21 for a cleaner divergence view. On 5m charts, 7 is better for catching quick reversals. |
| Divergence Lookback | 20 | Number of bars to scan for swing highs and lows when detecting divergences. A lower value (10-14) catches short-term divergences on lower timeframes. Higher values (30-50) find larger patterns on daily charts. I use 20 as a default on 1H BTC charts and it catches most meaningful divergences. |
| Divergence Threshold % | 0.5 | The minimum percentage difference between two swing points to register a divergence. At 0.5%, only clear divergences generate signals. I tried 0.3% on NQ 5m charts but got too many false alerts during noisy sessions. Above 1% filters aggressively and may miss real reversals. |
| Show Divergence Labels | true | Toggles on-chart labels for detected divergences. Keep this on during analysis to understand OBV structure. Turn it off on live charts if labels become distracting during fast price action. |
OBV + Pineify Invite-Only: Better Together
OBV alone gives you one signal type. Pineify invite-only indicator combines OBV with RSI divergences, MACD confirmation, and Supertrend filters in one overlay. Fewer charts, clearer signals.
Instead of switching between 7 different signals on separate charts, you get a single multi-confirmation setup.
See the Invite-Only IndicatorRelated Resources
FAQ
OBV Signals FAQ
Stop juggling OBV with 4 other charts
Pineify combines OBV, RSI, MACD, and Supertrend into one invite-only indicator. One click setup.
Try Pineify Free