OPEN-SOURCE SCRIPT
Market Order Bubbles by LZ (inspired by Leviathan)

Market Order Bubbles (inspired by Leviathan's original work) visualizes surges
in aggressive buying and selling activity, estimated from OHLCV data using a
simulated CVD approach. Use it as a reversal tool or to monitor real-time order
flow dynamics.
HOW TO READ THE BUBBLES
● Green bubble (below bar) — aggressive buying surge, price advanced effectively
→ neutral to bullish continuation
● Red bubble (above bar) — aggressive selling surge, price declined effectively
→ neutral to bearish continuation
● Orange bubble (below bar) — aggressive buying, but price failed to advance
→ buyer absorption / exhaustion → look for short
● Orange bubble (above bar) — aggressive selling, but price failed to decline
→ seller absorption / exhaustion → look for long
Bubble size reflects surge intensity: small / medium / large.
Only the dominant side is shown per bar (buy or sell volume must exceed the
other by at least 20%), eliminating ambiguous signals on high-volume two-sided
candles.
KEY DIFFERENCES FROM THE ORIGINAL
1. Percentile thresholds instead of EMA + StdDev
Volume is right-skewed. A single spike inflates standard deviation and
suppresses signals for many bars after. Rolling percentiles (90/95/99th)
are immune to this distortion.
2. Exhaustion vs. continuation detection (orange bubbles)
The original treats all bubbles as contrarian signals. This version
distinguishes between continuation flow (price moves with the surge) and
exhaustion / absorption (price fails to follow), giving each bubble a
clearer directional context.
3. Tiny-range bar protection
Bars with range < 0.1 × ATR(14) are skipped. Near-doji candles produce
unstable buy/sell volume estimates that can generate false signals.
4. Dominant-side filter
When buy and sell volume are close in magnitude, no bubble is shown.
Only a clear directional imbalance (≥ 20% edge) triggers a signal.
SETTINGS
Percentile Window — lookback length for threshold calculation (default 200)
Threshold 1/2/3 — percentile levels for small/medium/large bubbles
Tiny Range Filter — minimum bar range as ATR multiple (default 0.1)
Exhaustion Threshold — price efficiency cutoff for orange bubble (default 0.35)
lower close efficiency = buyer/seller failed to push price
TIPS
• Orange bubbles at swing highs/lows are the highest-probability signals.
• Consecutive same-color bubbles during a trend = continuation, not reversal.
• On lower timeframes (≤ 5m), reduce the percentile window to 100 for faster
adaptation to recent volume conditions.
• Pair with the companion Net Delta panel for a continuous view of buy/sell
pressure across all bars.
CREDITS
This indicator was built entirely with Claude Code as an experiment in
AI-assisted Pine Script development. All credit for the original concept
goes to Leviathan — this is simply a tribute and a tinkerer's exploration.
in aggressive buying and selling activity, estimated from OHLCV data using a
simulated CVD approach. Use it as a reversal tool or to monitor real-time order
flow dynamics.
HOW TO READ THE BUBBLES
● Green bubble (below bar) — aggressive buying surge, price advanced effectively
→ neutral to bullish continuation
● Red bubble (above bar) — aggressive selling surge, price declined effectively
→ neutral to bearish continuation
● Orange bubble (below bar) — aggressive buying, but price failed to advance
→ buyer absorption / exhaustion → look for short
● Orange bubble (above bar) — aggressive selling, but price failed to decline
→ seller absorption / exhaustion → look for long
Bubble size reflects surge intensity: small / medium / large.
Only the dominant side is shown per bar (buy or sell volume must exceed the
other by at least 20%), eliminating ambiguous signals on high-volume two-sided
candles.
KEY DIFFERENCES FROM THE ORIGINAL
1. Percentile thresholds instead of EMA + StdDev
Volume is right-skewed. A single spike inflates standard deviation and
suppresses signals for many bars after. Rolling percentiles (90/95/99th)
are immune to this distortion.
2. Exhaustion vs. continuation detection (orange bubbles)
The original treats all bubbles as contrarian signals. This version
distinguishes between continuation flow (price moves with the surge) and
exhaustion / absorption (price fails to follow), giving each bubble a
clearer directional context.
3. Tiny-range bar protection
Bars with range < 0.1 × ATR(14) are skipped. Near-doji candles produce
unstable buy/sell volume estimates that can generate false signals.
4. Dominant-side filter
When buy and sell volume are close in magnitude, no bubble is shown.
Only a clear directional imbalance (≥ 20% edge) triggers a signal.
SETTINGS
Percentile Window — lookback length for threshold calculation (default 200)
Threshold 1/2/3 — percentile levels for small/medium/large bubbles
Tiny Range Filter — minimum bar range as ATR multiple (default 0.1)
Exhaustion Threshold — price efficiency cutoff for orange bubble (default 0.35)
lower close efficiency = buyer/seller failed to push price
TIPS
• Orange bubbles at swing highs/lows are the highest-probability signals.
• Consecutive same-color bubbles during a trend = continuation, not reversal.
• On lower timeframes (≤ 5m), reduce the percentile window to 100 for faster
adaptation to recent volume conditions.
• Pair with the companion Net Delta panel for a continuous view of buy/sell
pressure across all bars.
CREDITS
This indicator was built entirely with Claude Code as an experiment in
AI-assisted Pine Script development. All credit for the original concept
goes to Leviathan — this is simply a tribute and a tinkerer's exploration.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.