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

**YBL – Order Flow Bubbles + Alerts (Imbalance, Anchored)**
by **YBL / Yuriel**
This tool paints **order flow “bubbles”** directly on the price chart whenever there is a strong **aggressive buy or sell imbalance**, using only OHLCV data (no real bid/ask feed required).
The script estimates delta from **price change × volume**, normalizes it with a **z-score**, and then draws visual bubbles on the candles where the imbalance is strong enough.
---
## 🔍 Core Logic (How It Works)
1. **Delta estimation (no bid/ask feed needed)**
- `delta = (close - open) * volume`
- If price closes above open → delta > 0 (buy aggression).
- If price closes below open → delta < 0 (sell aggression).
2. **Volatility / Z-score filter**
- Moving averages over **lenDelta**:
- `avgVol = SMA(volume)`
- `avgDelta = SMA(delta)`
- `stDelta = stdev(delta)`
- Z-score:
- `deltaZ = (delta - avgDelta) / stDelta`
- Only bars where:
- Volume is above `minVolMul × avgVol`
- |deltaZ| is above `zTrigger`
are considered **strong aggression bubbles**.
3. **Direction detection**
- **Buy bubble** = `delta > 0` with strong z-score and enough volume.
- **Sell bubble** = `delta < 0` with strong z-score and enough volume.
---
## 🎨 Visuals on the Chart
- **Bubbles (labels)**
- Green bubbles for **buy aggression**.
- Red bubbles for **sell aggression**.
- Bubble **size is dynamic** → based on `vol / avgVol`:
- Tiny / Small / Normal / Large / Huge depending on the volume ratio.
- Text inside the bubble (optional):
- Shows `Δ` in **K units** (e.g. `+35.2K`).
- Controlled by `Mostrar Δ (K) dentro de la burbuja`.
- **Anchoring options**
- `Anclaje de burbuja`:
- **“Extremos (Hi/Lo)”** →
- Buy bubbles anchored near **low + ATR offset**.
- Sell bubbles anchored near **high − ATR offset**.
- **“Centro (Mid)”** →
- Bubbles at the **midpoint** of the candle.
- ATR offset is defined by:
- `ATR para offset` (atrLen)
- `Offset = ATR ×` (atrMul)
- **Background shading (heatmap)**
- When a very strong **buy imbalance** appears → chart background tinted **light lime**.
- When a very strong **sell imbalance** appears → background tinted **light red**.
- Helps visually detect clusters of aggressive buying or selling.
- **Tooltips**
- Each bubble includes a tooltip with:
- `Δ` (raw delta)
- `z` (z-score of delta)
- % of volume vs average (Vol%)
---
## ⚙️ Inputs (Settings Overview)
### Group “Cálculo”
- **Longitud media/volatilidad (z-score)** (`lenDelta`)
Lookback for average volume, delta and standard deviation.
- **Umbral z-score desequilibrio fuerte** (`zTrigger`)
Higher = fewer but stronger signals.
- **Volumen mínimo (× promedio)** (`minVolMul`)
Minimum volume relative to average volume.
### Group “Dibujo”
- **Transparencia burbujas (0=opaco)**
Controls how strong the color of the bubbles is.
- **Mostrar Δ (K) dentro de la burbuja**
Toggle on/off the text inside the bubbles.
- **Tamaño del TEXTO**
tiny / small / normal / large / huge.
- **Anclaje de burbuja**
- “Extremos (Hi/Lo)” → buy near low, sell near high.
- “Centro (Mid)” → bubble in the middle of the bar.
- **ATR para offset** / **Offset = ATR ×**
Fine-tune vertical offset relative to high/low.
---
## 📢 Alerts
The script includes ready-to-use **alerts**:
1. **BUY Aggression Bubble**
- Triggered when a strong **buy imbalance** appears (green bubble).
- Message includes ticker, timeframe and close.
2. **SELL Aggression Bubble**
- Triggered when a strong **sell imbalance** appears (red bubble).
- Message includes ticker, timeframe and close.
Use these alerts to catch:
- Sudden bursts of **aggressive buying** at lows or pullbacks.
- Sudden bursts of **aggressive selling** at highs or after rallies.
- Potential **reversal** or **continuation** points based on flow.
---
## 🧠 How to Use (Practical Ideas)
- Combine this script with:
- **VWAP**, volume profile, liquidity pools or CVD.
- Your own session filters (e.g. NY open, London open).
- Look for:
- **Clusters of green bubbles** at support / VWAP → potential accumulation.
- **Clusters of red bubbles** at resistance / previous highs → possible distribution.
- Breakouts where the candle is supported by **large same-direction bubbles**.
It works especially well on:
- **1m / 5m** charts for scalping and intraday.
- Futures, indices, FX and crypto where volume is reliable.
---
## ⚠️ Disclaimer
This script is for **educational purposes only** and does **not** constitute financial advice.
Always backtest and use proper risk management before trading live.
---
© YBL / Yuriel – “YBL – Order Flow Bubbles + Alerts (Imbalance, Anchored)”
If you find this useful, please **leave a like ⭐ and add it to your favorites.**
by **YBL / Yuriel**
This tool paints **order flow “bubbles”** directly on the price chart whenever there is a strong **aggressive buy or sell imbalance**, using only OHLCV data (no real bid/ask feed required).
The script estimates delta from **price change × volume**, normalizes it with a **z-score**, and then draws visual bubbles on the candles where the imbalance is strong enough.
---
## 🔍 Core Logic (How It Works)
1. **Delta estimation (no bid/ask feed needed)**
- `delta = (close - open) * volume`
- If price closes above open → delta > 0 (buy aggression).
- If price closes below open → delta < 0 (sell aggression).
2. **Volatility / Z-score filter**
- Moving averages over **lenDelta**:
- `avgVol = SMA(volume)`
- `avgDelta = SMA(delta)`
- `stDelta = stdev(delta)`
- Z-score:
- `deltaZ = (delta - avgDelta) / stDelta`
- Only bars where:
- Volume is above `minVolMul × avgVol`
- |deltaZ| is above `zTrigger`
are considered **strong aggression bubbles**.
3. **Direction detection**
- **Buy bubble** = `delta > 0` with strong z-score and enough volume.
- **Sell bubble** = `delta < 0` with strong z-score and enough volume.
---
## 🎨 Visuals on the Chart
- **Bubbles (labels)**
- Green bubbles for **buy aggression**.
- Red bubbles for **sell aggression**.
- Bubble **size is dynamic** → based on `vol / avgVol`:
- Tiny / Small / Normal / Large / Huge depending on the volume ratio.
- Text inside the bubble (optional):
- Shows `Δ` in **K units** (e.g. `+35.2K`).
- Controlled by `Mostrar Δ (K) dentro de la burbuja`.
- **Anchoring options**
- `Anclaje de burbuja`:
- **“Extremos (Hi/Lo)”** →
- Buy bubbles anchored near **low + ATR offset**.
- Sell bubbles anchored near **high − ATR offset**.
- **“Centro (Mid)”** →
- Bubbles at the **midpoint** of the candle.
- ATR offset is defined by:
- `ATR para offset` (atrLen)
- `Offset = ATR ×` (atrMul)
- **Background shading (heatmap)**
- When a very strong **buy imbalance** appears → chart background tinted **light lime**.
- When a very strong **sell imbalance** appears → background tinted **light red**.
- Helps visually detect clusters of aggressive buying or selling.
- **Tooltips**
- Each bubble includes a tooltip with:
- `Δ` (raw delta)
- `z` (z-score of delta)
- % of volume vs average (Vol%)
---
## ⚙️ Inputs (Settings Overview)
### Group “Cálculo”
- **Longitud media/volatilidad (z-score)** (`lenDelta`)
Lookback for average volume, delta and standard deviation.
- **Umbral z-score desequilibrio fuerte** (`zTrigger`)
Higher = fewer but stronger signals.
- **Volumen mínimo (× promedio)** (`minVolMul`)
Minimum volume relative to average volume.
### Group “Dibujo”
- **Transparencia burbujas (0=opaco)**
Controls how strong the color of the bubbles is.
- **Mostrar Δ (K) dentro de la burbuja**
Toggle on/off the text inside the bubbles.
- **Tamaño del TEXTO**
tiny / small / normal / large / huge.
- **Anclaje de burbuja**
- “Extremos (Hi/Lo)” → buy near low, sell near high.
- “Centro (Mid)” → bubble in the middle of the bar.
- **ATR para offset** / **Offset = ATR ×**
Fine-tune vertical offset relative to high/low.
---
## 📢 Alerts
The script includes ready-to-use **alerts**:
1. **BUY Aggression Bubble**
- Triggered when a strong **buy imbalance** appears (green bubble).
- Message includes ticker, timeframe and close.
2. **SELL Aggression Bubble**
- Triggered when a strong **sell imbalance** appears (red bubble).
- Message includes ticker, timeframe and close.
Use these alerts to catch:
- Sudden bursts of **aggressive buying** at lows or pullbacks.
- Sudden bursts of **aggressive selling** at highs or after rallies.
- Potential **reversal** or **continuation** points based on flow.
---
## 🧠 How to Use (Practical Ideas)
- Combine this script with:
- **VWAP**, volume profile, liquidity pools or CVD.
- Your own session filters (e.g. NY open, London open).
- Look for:
- **Clusters of green bubbles** at support / VWAP → potential accumulation.
- **Clusters of red bubbles** at resistance / previous highs → possible distribution.
- Breakouts where the candle is supported by **large same-direction bubbles**.
It works especially well on:
- **1m / 5m** charts for scalping and intraday.
- Futures, indices, FX and crypto where volume is reliable.
---
## ⚠️ Disclaimer
This script is for **educational purposes only** and does **not** constitute financial advice.
Always backtest and use proper risk management before trading live.
---
© YBL / Yuriel – “YBL – Order Flow Bubbles + Alerts (Imbalance, Anchored)”
If you find this useful, please **leave a like ⭐ and add it to your favorites.**
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya secara bebas dan tanpa apa-apa had – ketahui lebih di sini.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya secara bebas dan tanpa apa-apa had – ketahui lebih di sini.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.