Obsidian Divergence Ledger [JOAT]Obsidian Divergence Ledger
Introduction
Obsidian Divergence Ledger is an open-source divergence engine built around confirmed pivot logic and a composite oscillator. It tracks regular and hidden divergence, draws ledger lines between the relevant pivot points, and can optionally project those same relationships onto price. The design is meant to make divergence readable as a structured event instead of a vague visual impression.
The problem this script solves is that many divergence tools are either too loose or too noisy. They often compare incompatible pivots, ignore volatility context, or signal before the pivot is confirmed. Obsidian avoids that by waiting for confirmed pivot structures, enforcing minimum spread requirements, and optionally filtering signals through baseline context and volatility expansion.
Core Concepts
1. Composite Oscillator Construction
The script does not depend on one oscillator only. It blends RSI, CMO, and ROC into one composite measure, then normalizes and smooths it. This helps reduce the chance that one indicator-specific quirk dominates the entire divergence decision.
2. Pivot-Confirmed Divergence Logic
Divergence is only evaluated after `ta.pivothigh()` and `ta.pivotlow()` confirm the turning points. That means the signal appears later than an unconfirmed visual guess, but it also means the structure is stable and suitable for non-repainting use.
pricePivotHigh = ta.pivothigh(high, leftBars, rightBars)
pricePivotLow = ta.pivotlow(low, leftBars, rightBars)
3. Regular and Hidden Divergence
The script distinguishes between reversal-type divergence and continuation-type divergence:
Regular bullish: price makes a lower low while the oscillator makes a higher low
Regular bearish: price makes a higher high while the oscillator makes a lower high
Hidden bullish: price makes a higher low while the oscillator makes a lower low
Hidden bearish: price makes a lower high while the oscillator makes a higher high
4. Ledger Line Visualization and Divergence Zoning
Each confirmed event is recorded visually with lines on the oscillator pane. When enabled, price-side lines are also drawn on the main chart using `force_overlay = true`. Regular divergence and hidden divergence use different color families and line styles so reversal and continuation structures are easy to distinguish. Fresh divergence events can also paint oscillator-side pivot zones and price-side context boxes so the compared structure is visible as an area, not just a single line.
5. Context, Freshness, and Impulse Framing
The script tracks whether a divergence is still fresh, whether it aligns with baseline context, and whether current volatility supports the signal. A central impulse ribbon and intensity band expand and contract with current state strength so the pane itself carries more information even when the dashboard is kept compact.
Features
Composite oscillator: RSI, CMO, and ROC blended into one smoother divergence source
Confirmed pivots only: No divergence state is confirmed before pivot confirmation
Regular and hidden divergence: Reversal and continuation structures handled separately
Optional volatility filter: Can require expansion before accepting signals
Optional baseline filter: Can require directional context relative to a baseline
Oscillator and price ledger lines: Divergence is drawn in both the pane and the price chart when enabled
Oscillator pivot zones: Fresh divergence events can stamp colored zones around the compared oscillator pivots
Price context boxes: The related price swing area can be boxed directly on the chart for faster structural reading
On-chart divergence tags: Compact labels identify regular-vs-hidden bullish and bearish events on the chart itself
Impulse ribbon and intensity band: The pane carries fresh-state emphasis through layered fills, not only through text
Compact dashboard summary: State, freshness, oscillator bias, and context remain available in a smaller top-right panel
Input Parameters
Composite Oscillator:
RSI Length
CMO Length
ROC Length
Normalization Window
Oscillator Smoothing
Divergence Engine:
Pivot Left Bars and Pivot Right Bars
Hidden Divergence toggle
Maximum Ledger Lines
Quality Filters:
Volatility Expansion toggle and length
Baseline Context toggle and baseline length
Minimum Oscillator Pivot Spread
How to Use This Indicator
Step 1: Wait for a Confirmed State
Use the dashboard's State and Freshness rows first. The script is designed to treat confirmed divergence as the event, not the early suspicion of divergence.
Step 2: Separate Reversal From Continuation
Regular divergence is generally more useful when looking for exhaustion. Hidden divergence is generally more useful when looking for pullback continuation. The script keeps those two ideas separate on purpose.
Step 3: Read Context Before Weighting the Signal
A bullish divergence below a weak baseline can still fail. A bearish divergence into expanding volatility can still continue. Use the Context and Volatility rows before deciding how much weight to give the latest signal.
Step 4: Use the Zones, Not Only the Lines
The oscillator pivot zones and price context boxes are there to show the compared structure as an area. This is useful when a divergence is technically valid but forms in a narrow or low-importance pocket. A wider, cleaner zone often carries more practical significance than a tiny local pivot mismatch.
Step 5: Use the Price Overlay Lines as Reference
The overlay lines show the exact price pivots involved in the latest comparison. The companion price labels and boxes make it easier to judge whether the divergence formed in an important location or in minor local noise.
Indicator Limitations
Pivot confirmation creates intentional delay because the script waits for bars on the right side of each pivot
Divergence can persist through multiple additional swings before price meaningfully reverses
A composite oscillator reduces single-indicator bias but cannot eliminate false positives
Hidden divergence is context-dependent and is less useful if the broader trend is weak or unclear
Fresh divergence boxes and labels describe the compared structure, but they do not guarantee that the marked zone will react again
Originality Statement
Obsidian Divergence Ledger is original in the way it structures divergence as a confirmed ledger of relationships rather than a simple shape marker. The script combines a custom composite oscillator, explicit regular-vs-hidden separation, freshness tracking, context filters, synchronized pane-plus-price ledger lines, oscillator pivot zoning, and price-context divergence boxes into one coherent tool.
Disclaimer
This script is provided for educational and informational purposes only. It is not financial advice. Divergence is a contextual condition, not a guarantee of reversal or continuation. False signals can occur frequently, especially in strong trends and low-liquidity markets. Use independent confirmation and risk management.
Pine Script® 인디케이터






















