OPEN-SOURCE SCRIPT

Delta Divergence [LliterH]

973
WHAT IT DOES

Delta Divergence detects real-time divergences between price movement and intrabar delta across six simultaneous time windows. When price moves in one direction but the net aggressive volume points the other way, the dashboard flags it as a BULL or BEAR divergence — giving you a multi-timeframe view of hidden order flow in a single overlay.

• BULL — Price falling while delta is positive: absorption or hidden buying pressure
• BEAR — Price rising while delta is negative: distribution or hidden selling pressure
• OK — Price and delta are synchronized, no anomaly detected


HOW IT WORKS

Delta is approximated from intrabar candles using request.security_lower_tf(). Each sub-candle within your chart bar is classified as buy or sell volume based on its direction (close vs. open or close vs. previous close). The net difference — buy volume minus sell volume — is the delta.

This delta is then accumulated over six configurable rolling time windows (default: 1m, 3m, 5m, 15m, 30m, 1h). The indicator compares the price direction across each window against its cumulative delta. When they disagree, you have a divergence.

The dashboard updates every bar and shows four columns per window:
• TF — Time window label
• Vol — Total volume with a directional arrow (↗ rising, ▼ falling vs. prior window)
• Delta — Net buy minus sell volume (Δ) with sign
• Signal — BULL / BEAR / OK with duration counter in seconds

Confluence across three or more windows simultaneously is the highest-confidence signal this tool produces.


HOW TO USE IT

snapshot

Step 1 — Identify confluence
A single window diverging is noise. Look for 3 or more windows showing the same signal at the same time. If the duration counter is growing on all of them, you are looking at sustained pressure — not a random fluctuation.

Step 2 — Read the duration
The number next to BULL or BEAR shows how many seconds the divergence has been active. A BULL signal held for 90+ seconds across the 1m, 3m, and 5m windows carries more weight than one that appeared two seconds ago.

snapshot

Step 3 — Confirm with price context
This indicator does not generate entries by itself. Use it alongside your structure, support/resistance, or session bias. The ideal scenario: price approaches a key level, the dashboard shows confluence with growing duration, and volume is expanding (↗ arrow).

snapshot

Step 4 — Use the alerts
Set the "Multi-Window Bull/Bear Confluence (3+)" alert to get notified without watching the dashboard. When the alert fires, check duration and volume, then apply your entry logic.


EXAMPLE SETUP — BTC/USDT 5m

• Chart: BTCUSDT 5-minute
• Lower TF input: 1m
• Price drops into a demand zone and stalls
• Dashboard shows BULL on 1m, 3m, and 5m windows
• Duration on all three is above 60 seconds and growing
• Vol column shows ↗ on the 1m and 3m windows
• This is the confluence picture worth acting on


SETTINGS

Delta Engine
• Lower TF — Must be below chart timeframe (e.g. 1m on a 5m chart)
• Classification method — Close vs Open or Close vs Prev Close
• Volume Assumption — Optional 40/60 split when only one side is recorded
• Min Delta / Min Price Change — Noise filters to suppress weak divergences

Time Windows
• Six independent windows, all configurable in seconds (default: 60, 180, 300, 900, 1800, 3600)

Dashboard
• Table position, text size, volume column toggle, duration toggle, symbol display

Colors
• Full control over bull, bear, neutral, background, and header colors


IMPORTANT NOTE

Delta in this indicator is approximated from candle direction — not from tick-by-tick order flow data. True delta requires exchange-level trade data that Pine Script does not provide without a Premium+ data feed using seconds-based timeframes. This tool is designed as a confluence and screening layer, not as a replacement for dedicated order flow platforms.


ALERTS

• Bull Divergence Detected — any window enters BULL state
• Bear Divergence Detected — any window enters BEAR state
• Multi-Window Bull Confluence (3+) — three or more windows in BULL simultaneously
• Multi-Window Bear Confluence (3+) — three or more windows in BEAR simultaneously

DISCLAIMER

This indicator is provided for educational and informational purposes only. It does not constitute financial, investment, or trading advice. Past performance is not indicative of future results. Trading involves substantial risk of loss and is not suitable for every investor. Always conduct your own research and consult a qualified financial professional before making any trading decisions. The author is not responsible for any losses incurred from the use of this tool

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.