PROTECTED SOURCE SCRIPT

YBL – Order Flow Bubbles + Alerts (Imbalance, Anchored)

89
YBL – Order Flow Bubbles + Alerts (Imbalance, Anchored)

This tool plots order-flow aggression bubbles directly on the price chart, using a z-score of candle delta (body × volume) plus a volume filter. The idea is to highlight bars where buying or selling aggression is significantly stronger than normal and to anchor that information at meaningful price levels.



🔧 Core logic
• Delta per bar
• delta = (close – open) × volume
• Positive delta → buy aggression (buyers lifting offers).
• Negative delta → sell aggression (sellers hitting bids).
• Z-score imbalance
• Uses lenDelta as the lookback window for:
• Average delta
• Standard deviation of delta
• Average volume
• A bar is considered strongly imbalanced when:
• |deltaZ| ≥ zTrigger, and
• Volume is at least minVolMul × average volume.
• Volume scaling → bubble size
• Bubble size is derived from the ratio volume / average volume:
• Small → Huge, based on how large the spike is compared to normal volume.



🎯 Bubble placement & visuals
• Color
• Lime bubble = strong buy bar.
• Red bubble = strong sell bar.
• Label text (optional)
• You can display the delta value in “K” inside the bubble (e.g. +350.0K).
• Anchoring
• Two anchor modes:
• “Extremos (Hi/Lo)” → bubble anchored near high or low of the candle, offset by ATR.
• “Centro (Mid)” → bubble anchored at the midpoint between high and low.
• ATR offset
• Uses ATR × atrMul to push the bubble slightly away from the extreme, so it doesn’t overlap the wick or other drawings.
• Soft background shading
• When a strong buy bar is detected → light green background.
• When a strong sell bar is detected → light red background.
This makes high-pressure zones easy to see when scrolling quickly.



🔔 Alerts

Two built-in alert conditions:
• BUY Aggression Bubble
Triggered when a strong bullish imbalance appears (green bubble).
• SELL Aggression Bubble
Triggered when a strong bearish imbalance appears (red bubble).

The alert messages include ticker, timeframe and close price so they can be used for automated notifications or as part of a trading workflow.



📈 Typical use
• Spot aggressive entry points where institutional players are likely hitting bids/offers.
• Mark key reaction levels (high/low or mid of the bubble candle) to watch for future retests.
• Combine with CVD / Smart Money Volume / institutional levels as extra confluence for entries, scalps or reversals.



⚠️ Disclaimer
This script is for educational and analytical purposes only. It is not financial advice. Always do your own research and manage your risk.

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.