OPEN-SOURCE SCRIPT
Queso Heat Index

Queso Heat Index (QHI) — ATR-Adaptive Edge-Pressure Gauge
QHI measures how strongly price is pressing the edges of a rolling consolidation window. It heats up when price repeatedly pushes the window up, cools down when it pushes down, and drifts back toward neutral when price wanders in the middle. Everything is ATR-normalized so it adapts across symbols and timeframes.
Output: a signed score from −100 … +100
What you’ll see on the chart
How it works (under the hood)
How to read it
Key inputs (what they do)
Tuning quick-starts
Alerts (included)
Best practices & notes
TL;DR
QHI measures how strongly price is pressing the edges of a rolling consolidation window. It heats up when price repeatedly pushes the window up, cools down when it pushes down, and drifts back toward neutral when price wanders in the middle. Everything is ATR-normalized so it adapts across symbols and timeframes.
Output: a signed score from −100 … +100
- > 0 = bullish pressure (hot)
- < 0 = bearish pressure (cold)
- ≈ 0 = neutral (no side dominating)
What you’ll see on the chart
- Rolling “box” (Donchian window): top, bottom, and midline.
- Optional compact-box shading when the window height is small relative to ATR.
- Background “thermals”: tinted [color=red]red[/color] when Heat > Hot threshold, [color=blue]blue[/color] when Heat < Cold threshold (intensity scales with the score).
- Optional Heat line (−100..+100), optional 0/±80 thresholds, and optional push markers (PU/PD).
- Optional table showing the current Heat score, placeable in any corner.
How it works (under the hood)
- Consolidation window — Over lookback bars we track highest high (top), lowest low (bottom), and midpoint. The window is called “compact” when box height ≤ ATR × maxRangeATR.
- ATR-based push detection — A bar is a push-up if high > prior window high + (epsATR × ATR + tick buffer). A push-down if low < prior window low − (epsATR × ATR + tick buffer). We also measure how many ATRs beyond the edge the bar traveled.
- Heat gains (symmetric) — Each push adds/subtracts Heat:
base gain + streak bonus × consecutive pushes + magnitude bonus × ATRs beyond edge. - Decay toward neutral — Each bar, Heat decays by a percentage. Decay is:
– higher in the middle band of the box, and
– adaptive: the farther (in ATRs) from the relevant band (top when hot, bottom when cold), the faster it decays; hugging the band slows decay. - Midpoint bias (optional) — Gentle drift toward hot when trading above mid, toward cold when below mid, with a dead-zone near mid so tiny wobbles don’t matter.
- Reset on regime flip (optional) — First valid push from the opposite side can snap Heat back to 0 before applying new gains.
How to read it
- Rising hot with slow decay → strong upside pressure; pullbacks that hold near the top band often continue.
- Flip to cold after being hot → regime change risk; tighten risk or consider the other side.
- Compact window + rising hot (or cold) → squeeze-and-go conditions.
- Neutral (≈ 0) → edges aren’t being pressured; expect mean-reversion inside the box.
Key inputs (what they do)
- Window & ATRlookback: size of the Donchian window (longer = smoother, slower).
atrLen: ATR period for all volatility-scaled thresholds.
maxRangeATR: defines “compact” windows for optional shading.
topBottomFrac: how thick the top/bottom bands are (used for decay/pressure logic). - Push detection (ATR-based)epsATR: how many ATRs beyond the prior edge to count as a real push.
tickBuff: fixed extra ticks beyond the ATR epsilon (filters micro-breaches). - Heat gainsgainBase: main fuel per push.
gainPerStreak: rewards consecutive pushes.
gainPer1ATRBrk: adds more for stronger breakouts past the edge.
resetOppSide: snap back to 0 on the first opposite-side push. - DecaydecayPct: baseline % removed each bar.
decayAccelMid: multiplies decay when price is in the middle band.
adaptiveDecay, decayMinMult, decayPerATR, decayMaxMult: scale decay with ATR distance from the nearest “target” band (top if hot, bottom if cold). - Midpoint biasuseMidBias: enable/disable drift above/below midpoint.
midDeadFrac: width of neutral (no-drift) zone around mid.
midBiasPerBar: max drift per bar at the box edge. - Visuals (all default to OFF for a clean chart)
- Plot Heat line + Show 0/±80 lines (only shows thresholds if Heat line is on).
- Hot/Cold thresholds & transparency floors for background shading.
- Push markers (PU/PD).
- Heat score table: toggle on; choose any corner.
- Plot Heat line + Show 0/±80 lines (only shows thresholds if Heat line is on).
Tuning quick-starts
- Daily trending equities: lookback 40–60; epsATR 0.10–0.25; gainBase 12–18; gainPerStreak 0.5–1.5; gainPer1ATRBrk 1–2; decayPct 3–6; adaptiveDecay ON (decayPerATR 0.5–0.8).
- Intraday / noisy: raise epsATR and tickBuff to filter noise; keep decayPct modest so Heat can build.
- Weekly swing: longer lookback/atrLen; slightly lower decayPct so regimes persist.
Alerts (included)
- New window HIGH (push-up)
- New window LOW (push-down)
- Heat turned HOT (crosses above your Hot threshold)
- Heat turned COLD (crosses below your Cold threshold)
Best practices & notes
- Use QHI as a pressure gauge, not a standalone system—combine with your entry/exit plan and risk rules.
- On thin symbols, increase epsATR and/or tickBuff to avoid spurious pushes.
- Gap days can register large pushes; ATR scaling helps but consider context.
- Want the Heat in a separate pane? Use the companion panel version; keep this overlay for background/box visuals.
- Pine v6. Warm-up: values appear as soon as one bar of window history exists.
TL;DR
- QHI quantifies how hard price is leaning on a consolidation edge.
- It’s ATR-adaptive, streak- and magnitude-aware, and cools off intelligently when momentum fades.
- Watch for thermals (background), the score (−100..+100), and fresh push alerts to time entries in the direction of pressure.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.