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.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。