OPEN-SOURCE SCRIPT
OBV Regime Shift [I.M]

OVERVIEW
🟣 OBV Regime Shift ("OBV-RS [I.M]") is a volume-flow regime detector that goes far beyond the classic "OBV + moving average" cross. It normalizes On-Balance Volume into a rolling z-score, applies a dual-MA system (HMA fast + DEMA slow) with slope acceleration, hunts price/OBV divergences on confirmed pivots, and aggregates everything into a single 0–100 Regime Score that flags BULLISH ▲ / BEARISH ▼ / NEUTRAL — state shifts.
The screenshot below shows the indicator running on BTCUSDT (Binance) on the 15-minute timeframe — refer back to it throughout the description, since each section describes the same chart.
📊 Live example chart:

WHAT YOU SEE ON THE CHART
Looking at the example image, from left to right and top to bottom:
🟣 The adaptive ribbon is the visual core of the indicator. Two lines — a Hull MA (fast) and a DEMA (slow) — are drawn on top of the normalized OBV, with a filled glow between them. When the fast line is above the slow line, the entire ribbon turns green (buy bias); when the fast line crosses below, the ribbon flips to magenta (sell bias). The glow halo and fill are intentional — they let you read regime at a glance without studying the lines.
🟣 The slope differential histogram at the zero line shows the acceleration gap between the two MAs. Green columns above zero = momentum is opening up; magenta columns below = momentum is collapsing. It often turns before the ribbon itself flips, acting as an early warning.
🟣 The "SHIFT ▼" and "SHIFT ▲" triangles mark confirmed regime transitions, not raw threshold crossings. A shift only prints when the Regime Score holds above 80 (or below 20) for two consecutive bars, with a minimum of 12 bars since the previous shift. This is deliberate — most OBV-based indicators ping-pong every other candle; this one earns each signal.
🟣 The "div ▲ / div ▼" diamonds print on pivot confluences: price makes a higher high while normalized OBV makes a lower high (or the inverse for bullish), AND the slope differential agrees with the divergence direction. The slope-confirmation filter cuts roughly 70% of the false divergences a naive pivot-comparison would generate.
🟣 The bottom-right panel is the at-a-glance summary: current Score (0–100), Regime label, Momentum state (Accelerating ▲ / Slowing ▼ / Flat), active Divergence, Volume expansion state, and the raw OBV z-score. The score number turns gold when it reaches an extreme zone (≥85 or ≤15).
🟣 The background flash is intentionally brief: three bars of green or magenta tint only on the bar a shift fires, then it clears. The indicator surfaces the event, not the state — your eye finds new shifts, not a wall of color.
WHAT MAKES IT ORIGINAL
OBV-RS [I.M] is not a wrapper around ta.obv() with a moving average glued on top. The originality is in how four independent ideas are combined and filtered:
🟣 Normalized OBV (z-score)
Raw OBV has an absolute scale that drifts with volume regime — comparing today's OBV to a six-month-old reading is meaningless. The script standardizes OBV into a rolling z-score over a configurable lookback window, so the same +1.5 reading means the same thing in a low-volume drift as it does in a high-volume rally. Every downstream calculation operates on this normalized series.
🟣 Dual-MA with slope acceleration
The fast line is a Hull MA — low-lag, responsive to inflections. The slow line is a DEMA — smoother but still ahead of a traditional EMA of the same length. The script computes the slope of each over a configurable window, then takes the slope differential (fastSlope − slowSlope). This differential, not the cross itself, is the leading indicator: it widens before the lines visually separate and contracts before they merge.
🟣 Slope-confirmed divergence engine
Most divergence scripts flag every higher-high-lower-high pivot pair, which floods the chart with noise. OBV-RS demands a third condition: the slope differential must agree with the divergence direction at the moment the second pivot prints. A bearish divergence only counts if the slope is already weakening; a bullish divergence only counts if the slope is already turning up. This single filter is the difference between a useful divergence signal and a pivot-spam indicator.
🟣 Regime Score (0–100) with multi-bar confirmation
Four components feed the score: slope differential (45% weight), distance between fast and slow lines (35% weight), a neutral anchor (20%), plus bonuses from active divergences and current volume expansion. The score is then gated through a two-step confirmation: it must hold above the bullish threshold (or below the bearish one) for a configurable number of consecutive bars before the state actually flips. A minimum bar gap between shifts prevents ping-pong. Together, these filters turn a noisy oscillator into a high-conviction regime tracker.
HOW TO USE IT
🟣 Ribbon color = directional bias. Green ribbon = look for longs / hold longs. Magenta ribbon = look for shorts / hold shorts / cash. Do not fight the ribbon; let it confirm.
🟣 SHIFT triangles = regime change. A SHIFT ▼ at the top means volume flow has flipped bearish with confirmation. A SHIFT ▲ at the bottom means the opposite. These are not entry signals on their own — they are context. Combine them with your price-action setup, your structure tool, or with my other indicators (LSE [I.M], Liquidity Confluence [I.M]).
🟣 Divergence diamonds = exhaustion warnings. A bearish divergence inside a bullish ribbon is a "be careful, the bid is fading" signal — tighten stops, don't add. A bullish divergence inside a bearish ribbon is the opposite. Divergences against the regime are more useful than divergences in the direction of the regime.
🟣 Score panel = quick read. Score above 70 with Momentum Accelerating ▲ and Volume Expanding = strong bullish regime. Score below 30 with Accelerating ▼ and Contracting = strong bearish. Anything between 30–70 = no-trade context for momentum strategies.
🟣 Best timeframes: 15-minute to 1-hour on liquid instruments (BTC, ETH, SOL, major FX, SPX/NDX/DXY, gold). Lower than 15m gets noisy regardless of filters. Higher than 4h works but the score becomes very slow to update.
🟣 What this indicator is NOT: it is not an entry signal generator and it does not predict price. It tells you what kind of market you are in — that is the prerequisite for everything else.
📌 Free and open to all. Feedback, improvement ideas and edge cases welcome in the comments.
🟣 OBV Regime Shift ("OBV-RS [I.M]") is a volume-flow regime detector that goes far beyond the classic "OBV + moving average" cross. It normalizes On-Balance Volume into a rolling z-score, applies a dual-MA system (HMA fast + DEMA slow) with slope acceleration, hunts price/OBV divergences on confirmed pivots, and aggregates everything into a single 0–100 Regime Score that flags BULLISH ▲ / BEARISH ▼ / NEUTRAL — state shifts.
The screenshot below shows the indicator running on BTCUSDT (Binance) on the 15-minute timeframe — refer back to it throughout the description, since each section describes the same chart.
📊 Live example chart:
WHAT YOU SEE ON THE CHART
Looking at the example image, from left to right and top to bottom:
🟣 The adaptive ribbon is the visual core of the indicator. Two lines — a Hull MA (fast) and a DEMA (slow) — are drawn on top of the normalized OBV, with a filled glow between them. When the fast line is above the slow line, the entire ribbon turns green (buy bias); when the fast line crosses below, the ribbon flips to magenta (sell bias). The glow halo and fill are intentional — they let you read regime at a glance without studying the lines.
🟣 The slope differential histogram at the zero line shows the acceleration gap between the two MAs. Green columns above zero = momentum is opening up; magenta columns below = momentum is collapsing. It often turns before the ribbon itself flips, acting as an early warning.
🟣 The "SHIFT ▼" and "SHIFT ▲" triangles mark confirmed regime transitions, not raw threshold crossings. A shift only prints when the Regime Score holds above 80 (or below 20) for two consecutive bars, with a minimum of 12 bars since the previous shift. This is deliberate — most OBV-based indicators ping-pong every other candle; this one earns each signal.
🟣 The "div ▲ / div ▼" diamonds print on pivot confluences: price makes a higher high while normalized OBV makes a lower high (or the inverse for bullish), AND the slope differential agrees with the divergence direction. The slope-confirmation filter cuts roughly 70% of the false divergences a naive pivot-comparison would generate.
🟣 The bottom-right panel is the at-a-glance summary: current Score (0–100), Regime label, Momentum state (Accelerating ▲ / Slowing ▼ / Flat), active Divergence, Volume expansion state, and the raw OBV z-score. The score number turns gold when it reaches an extreme zone (≥85 or ≤15).
🟣 The background flash is intentionally brief: three bars of green or magenta tint only on the bar a shift fires, then it clears. The indicator surfaces the event, not the state — your eye finds new shifts, not a wall of color.
WHAT MAKES IT ORIGINAL
OBV-RS [I.M] is not a wrapper around ta.obv() with a moving average glued on top. The originality is in how four independent ideas are combined and filtered:
🟣 Normalized OBV (z-score)
Raw OBV has an absolute scale that drifts with volume regime — comparing today's OBV to a six-month-old reading is meaningless. The script standardizes OBV into a rolling z-score over a configurable lookback window, so the same +1.5 reading means the same thing in a low-volume drift as it does in a high-volume rally. Every downstream calculation operates on this normalized series.
🟣 Dual-MA with slope acceleration
The fast line is a Hull MA — low-lag, responsive to inflections. The slow line is a DEMA — smoother but still ahead of a traditional EMA of the same length. The script computes the slope of each over a configurable window, then takes the slope differential (fastSlope − slowSlope). This differential, not the cross itself, is the leading indicator: it widens before the lines visually separate and contracts before they merge.
🟣 Slope-confirmed divergence engine
Most divergence scripts flag every higher-high-lower-high pivot pair, which floods the chart with noise. OBV-RS demands a third condition: the slope differential must agree with the divergence direction at the moment the second pivot prints. A bearish divergence only counts if the slope is already weakening; a bullish divergence only counts if the slope is already turning up. This single filter is the difference between a useful divergence signal and a pivot-spam indicator.
🟣 Regime Score (0–100) with multi-bar confirmation
Four components feed the score: slope differential (45% weight), distance between fast and slow lines (35% weight), a neutral anchor (20%), plus bonuses from active divergences and current volume expansion. The score is then gated through a two-step confirmation: it must hold above the bullish threshold (or below the bearish one) for a configurable number of consecutive bars before the state actually flips. A minimum bar gap between shifts prevents ping-pong. Together, these filters turn a noisy oscillator into a high-conviction regime tracker.
HOW TO USE IT
🟣 Ribbon color = directional bias. Green ribbon = look for longs / hold longs. Magenta ribbon = look for shorts / hold shorts / cash. Do not fight the ribbon; let it confirm.
🟣 SHIFT triangles = regime change. A SHIFT ▼ at the top means volume flow has flipped bearish with confirmation. A SHIFT ▲ at the bottom means the opposite. These are not entry signals on their own — they are context. Combine them with your price-action setup, your structure tool, or with my other indicators (LSE [I.M], Liquidity Confluence [I.M]).
🟣 Divergence diamonds = exhaustion warnings. A bearish divergence inside a bullish ribbon is a "be careful, the bid is fading" signal — tighten stops, don't add. A bullish divergence inside a bearish ribbon is the opposite. Divergences against the regime are more useful than divergences in the direction of the regime.
🟣 Score panel = quick read. Score above 70 with Momentum Accelerating ▲ and Volume Expanding = strong bullish regime. Score below 30 with Accelerating ▼ and Contracting = strong bearish. Anything between 30–70 = no-trade context for momentum strategies.
🟣 Best timeframes: 15-minute to 1-hour on liquid instruments (BTC, ETH, SOL, major FX, SPX/NDX/DXY, gold). Lower than 15m gets noisy regardless of filters. Higher than 4h works but the score becomes very slow to update.
🟣 What this indicator is NOT: it is not an entry signal generator and it does not predict price. It tells you what kind of market you are in — that is the prerequisite for everything else.
📌 Free and open to all. Feedback, improvement ideas and edge cases welcome in the comments.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。