Daily Levels + Score# Daily Levels + Score (DHL×2)
---
## WHAT IT DOES
Most support/resistance scripts draw every level they find and leave you to guess which ones matter. DHL×2 finds the daily highs and lows that cluster together, draws them on your intraday chart, and then **grades each level with a statistical effectiveness score** based on how price actually reacted to it — evaluated strictly out-of-sample, so a level never "confirms itself". It also maps the current premium/discount context of the range with a time-at-price profile (POC / VAH / VAL).
## HOW IT WORKS
**1. Level detection — density clustering (KDE).**
Daily highs and lows over the lookback window are grouped with a kernel density estimate (triangular kernel, bandwidth = tolerance). Levels are the peaks of that density, so the result does not depend on the order in which candles are scanned, unlike the usual greedy grouping. Each touch is weighted by recency, and the final level is the weighted average of its touches. Tolerance adapts to volatility: Parkinson (default, converges faster after regime changes) or ATR.
**2. No self-confirmation bias.**
The touches that *form* a cluster do not count as tests. A cluster is "born" once it gathers the minimum number of touches; everything after that candle is out-of-sample evaluation. This is the key difference from scripts that count the same touches twice — once to build the level and again to "prove" it works.
**3. Effectiveness score.**
From its birth onward, every approach to the level is classified as respected or broken (consecutive candles in the zone count as one event). Three score modes:
- **Wilson 95%** — lower bound of the confidence interval; small samples are pushed toward 0 instead of showing a misleading "100% (2/2)".
- **Bayes (shrinkage)** — empirical Bayes: each level's score is pulled toward the base rate of all levels on the chart, with a configurable prior strength.
- **Raw %** — no correction, for comparison.
On top of that:
- **Time decay** — a respect from 30 days ago weighs less than yesterday's (configurable half-life).
- **Liquidity-consumption penalty** — consecutive respected tests progressively weaken the score, mimicking how resting orders get consumed at a real level.
- **Bounce magnitude (MFE)** — the average favorable excursion after each respect, expressed in daily-volatility multiples (σ), shown next to the score.
**4. Confluence.**
Round numbers (●, step configurable: e.g. 100 for NQ, 25 for ES) and proximity to the range equilibrium (◆) add a score bonus.
**5. Premium / Discount + time-at-price profile.**
The selected range (previous day, last N days, or full lookback) is split with fib lines (0 / 25 / 50 / 75 / 100) and an equilibrium line. A TPO-style **time-at-price profile** (no volume needed) is built from chart-resolution bars inside the range and plots the **POC, VAH and VAL**. When the POC sits meaningfully away from the geometric equilibrium (threshold as % of the range), the status label flags the imbalance with its direction: **POC>EQ** (p-shaped, value built in premium) or **POC
Chỉ báo






















