PROTECTED SOURCE SCRIPT

YBL – LITE HUD (Vol/Δ + Heatmap RVOL + Squeeze)

16
**YBL – LITE HUD (Vol/Δ + RVOL Heatmap + Squeeze) + ADV**
by **YBL / Yuriel**

This script is a **compact volume & squeeze HUD** that combines:

1. A **LITE Vol/Δ scanner** (fast accumulation of up vs down volume).
2. A **Volume Heatmap / RVOL engine** (percentiles or relative volume).
3. A **Squeeze Momentum panel** (BB vs KC + momentum color).
4. Optional **ADV metrics** (POWER vs reference symbol, trend/momentum, correlation).

All in one **single panel**, with a **HUD table** on the top-right summarizing the key stats for quick decision making.

---

## 🔍 1. LITE Vol/Δ (Fast Volume Imbalance)

The LITE block computes accumulated **up volume vs down volume** over a short lookback:

- `N° de velas (Vol/Δ)` → number of bars used for the mini volume window.
- `upVol` = sum of volume where `close >= open`.
- `dnVol` = sum of volume where `close < open`.
- `TotVol` = upVol + dnVol.
- `ΔAcc (dAcc)` = upVol − dnVol (net volume imbalance).

HUD shows:
- Total Δ volume (`VOL/Δ`) with arrow **▲ / ▼ / ▬** based on sign.
- Total volume of the window.

This gives you a **very quick read** of who is dominating in the last X bars.

---

## 🔥 2. Heatmap / Relative Volume (RVOL)

You can choose between two coloring modes:

### a) Heatmap (Percentiles)
- Uses `ta.percentile_linear_interpolation` over a **volume window** (`Ventana (barras)`).
- **p1, p2, p3** = low/mid/high percentile thresholds.
- Bars are colored:
- **Low** (gray), **Medium** (teal), **High** (orange), **Ultra** (red).
- **Max** of the session/day in **fuchsia**.

### b) RVOL (x Promedio)
- `RVOL = volume / SMA(volume, len)`.
- Thresholds:
- **Umbral RVOL 1/2/3** → 1.5x, 2x, 3x average by default.
- Same color logic: gray → teal → orange → red → fuchsia (session max).

Additional options:
- **Reiniciar máximo por día/sesión** → track a fresh session max each new day.
- **Línea del máximo de sesión** → plot line marking the highest volume of the session.
- **Pintar velas por Heatmap/RVOL** → candle color based on volume regime.

The HUD row:
- `"RVOL (Heatmap / RVOL)"` shows either:
- RVOL (e.g. `2.3x`), and uses the same **heatmap color**.

---

## 🎯 3. Squeeze Momentum (BB vs KC)

Classic Squeeze logic (similar to BB vs KC / TTM-style):

- **BB**:
- `basis = SMA(src, lenBB)`
- `upperBB = basis + multBB * stdev`
- `lowerBB = basis - multBB * stdev`
- **KC**:
- `maKC = SMA(src, lenKC)`
- `upperKC = maKC + multKC * ATR`
- `lowerKC = maKC - multKC * ATR`

Squeeze states:
- **Squeeze ON**: BB inside KC.
- **Squeeze OFF**: BB outside KC.

Momentum:
- `momBase = src − SMA(src, lenBB)`
- `mom = linreg(momBase, 20, 0)`
- Colored:
- Up & rising → **lime**.
- Up & falling → **green**.
- Down & rising → **orange**.
- Down & falling → **red**.

Panel options:
- **Panel a mostrar**:
- `Volumen` → only volume side.
- `Squeeze` → only squeeze/momentum.
- `Ambos` → both volume + squeeze.
- **Normalizar (z-score) cuando eliges 'Ambos'**:
- Uses **zVol** and **zMom** (z-scored) so both share a common scale.

Visuals:
- Histograms for volume/zVol.
- Columns for squeeze/zMom.
- Zero line + **Squeeze ON/OFF dots** at the bottom.

---

## 🧮 4. Normalization & zVol Color (Both Panels)

When **panelMode = Ambos** and **Normalize** is ON:

- `zVol = zscore(volume, lenNorm)`
- `zMom = zscore(mom, lenNorm)`
- Both are plotted on **the same normalized panel**, letting you compare **volume shocks vs momentum swings**.

Color logic for volume bars in that mode:
- Based on |zVol| vs thresholds **Z1, Z2, Z3**:
- < Z1 → Low (gray).
- < Z2 → Medium (teal).
- < Z3 → High (orange).
- ≥ Z3 → Ultra (red).
- Session max still highlighted in **fuchsia**.

Title mode:
- **Auto / Forzar Normalizado / Forzar Original** → controls whether panel titles say `zVol / zMom` or `Volumen / Squeeze Momentum`.

---

## 🧠 5. ADV Metrics (Optional Heavy Block)

ADV is optional (toggle `Activar métricas avanzadas`). It adds:

### a) POWER vs Reference Symbol
- Reference symbol: **`cmpSymbol`** (default: `TVC:DXY`).
- Computes returns:
- `retA = ROC(close, powLen)` for current chart.
- `retB = ROC(cmpClose, powLen)` for reference.
- Z-scored returns: `zA`, `zB`, and:
- **POWER score** = `pScore = zA − zB`.
- HUD row:
- `"POWER vs {symbol}"` with **↑ / ↓ / ▬** and color:
- Green if pScore > 0 (outperforming).
- Red if pScore < 0 (underperforming).

### b) Trend / Momentum
- EMAs:
- `EMA rápida` and `EMA lenta`:
- **BullTrend** when `emaFast > emaSlow` and price > emaSlow.
- Momentum:
- `momAdv = RSI(close, momLen) - 50`.
- HUD row:
- `"TEND/MOM"` → `Alcista/Bajista` + momentum value, colored:
- Green = bullish.
- Red = bearish.

### c) Correlation vs Reference
- `corrVal = correlation(close, cmpClose, corrLen)`.
- HUD row:
- `"CORREL vs {symbol}"` with corrVal and note:
- `>0.3` = direct (green).
- `<-0.3` = inverse (red).
- Otherwise neutral (gray).

---

## 🧱 6. HUD Table (Top Right)

When **Mostrar HUD (tabla)** is ON, the table shows up to **6 rows**:

1. **VOL/Δ (LB N)** → net Δ and total volume of the lookback window.
2. **RVOL (Heatmap / RVOL)** → RVOL and its heatmap color.
3. **MAX sesión / MAX (global)** → current session max, highlight when a new max is printed.
4. **POWER vs Symbol** (ADV) → relative performance vs `cmpSymbol`.
5. **TEND/MOM** (ADV) → trend state + momentum.
6. **CORREL vs Symbol** (ADV) → correlation reading with simple interpretation.

It’s designed as a **quick decision HUD**: all key flow info in one glance.

---

## 🎨 Candle Painting Priority

You can control how candles are colored:

- **Modo de pintura**:
- `Solo Squeeze` → only squeeze momentum colors.
- `Solo Heatmap` → only volume heatmap/RVOL colors.
- `Auto: Squeeze > Heatmap` → squeeze colors override, else heatmap.

Squeeze painting:
- Up momentum → lime (transparent).
- Down momentum → red (transparent).

Heatmap painting:
- Uses the **same color regime** as the volume panel.

---

## 🔔 Alerts

Built-in alert:

- **YBL – Nuevo máximo de volumen (sesión)**
- Triggers when a **new volume high for the session/day** is printed.
- Useful to spot **capitulation bars**, volume spikes at key levels, etc.

---

## 🧪 How to Use (Practical Ideas)

- Load this HUD on a **separate panel** under your price chart.
- Combine it with:
- VWAP, liquidity pools, or other YBL tools (CVD, bubbles, etc.).
- Look for:
- Strong RVOL + Squeeze OFF + bullish HUD → momentum breakout.
- RVOL spikes at session high/low with squeeze ON → potential reversal.
- ADV POWER aligning with squeeze & RVOL → higher confidence directional bias.

Works great on:
- **Intraday (1m–15m)** for scalpers and day traders.
- **Swing (1H–4H)** with ADV turned ON for context vs DXY or indices.

---

## ⚠️ Disclaimer

This script is for **educational purposes only** and does **not** constitute financial advice.
Always backtest and manage risk properly before using it in live trading.

---

© YBL / Yuriel – “YBL – LITE HUD (Vol/Δ + RVOL Heatmap + Squeeze) + ADV”
If you find this helpful, please **leave a like ⭐ and add it to your favorites.**

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.