Squeeze-and-expansion indicator
DH DH filter · DH S/M · DH 1H
DH is a “quietness meter”: it shows whether the market is squeezed or running wild. A long quiet spell is often followed by a strong move.
A channel-width indicator built from candle open and body midpoint (no wicks): s_abs, B0…B8 profile, the “barrier” and a min/max detector with a k·STEP threshold. Gives no direction; used as an entry filter for segments.
⟳ being refined
The market moves in waves: it goes quiet, then it explodes. DH watches how “widely” price wanders and tells you when the quiet is about to end.
Picture someone walking down the street. You don't follow every step they take. You just note how much of the sidewalk they covered over the last half hour.
If they walked straight, the strip is narrow. If they zigzagged from edge to edge, the strip is wide. DH does the same with price: it measures how wide the “corridor” was that price stayed in over the last few candles.
The spring
While the corridor is shrinking, the indicator waits. When the corridor gets noticeably wider again (by two STEPs), it says: “the spring has let go, a move is probably coming.”
What DH can't do
DH doesn't know where price will go, up or down. It's like a seismograph: it sees the shaking but doesn't know which way the cupboard will fall. And it finds out late, one to four hours after the fact.
Why a trader needs it
The DH filter is like a traffic light before a trade. The trading system finds where to enter on its own (that's what segments do). The traffic light just says: “it's quiet, wait” or “the market is waking up, go ahead.”
DH has two “speeds”: a fast line S (looks at a short stretch of time) and a slow line M (looks at a long one). It's best when both say “the quiet is ending.”
Honestly: tests on real data show the traffic light helps only a little. It's useful in certain combinations, for example together with the golden trend. Those are being checked on new days right now.
Definition
DH is Andrey Maltsev's own indicator (archive DH_signals_patch, 19 Oct 2026). It is based on the candle's DH-Levels: its open and the body midpoint (open + close)/2. The indicator measures the channel width over these points (wicks are ignored) and catches the “compression → expansion” phase change. It gives no direction: “it measures width, not side.”
Pipeline
- Width. For each candle lo = min(open, mid), hi = max(open, mid). Over a window w:
s_abs = max(hi) − min(lo), including the current candle; there is also*_pct = width / close · 100. s_abs rises only when price leaves the channel and falls only when the extreme drops out of the window w candles later (“forgetting”, not a market event). On MOEX the line changes on only 28% of candles. - Profile B0…B8. From the previous 200–2,000 values of the line (current one excluded): R = max − min, Bk = min + k·R/8, buffer R/16.
- Barrier. The line in [B0, B1 + R/16] — the bottom 3/16 of the range. This is not rare: s_abs sits in the barrier 42–53% of the time on MOEX and 49% on BTC 5m.
- Min/max detector. A “looking for min / looking for max” state machine with threshold
k·STEP(k = 2): a min is confirmed once the line rises k·STEP off the low; a max once it falls k·STEP off the high. Runs shorter thanmin_bars(3) are discarded. - Extreme zone. For a min: BELOW_B0, AT_B0, IN_BARRIER (the author's “ideal”), AT_B2, ABOVE_B2; for a max, mirrored up to ABOVE_B8.
- Filter. The DH state on the entry candle's close decides whether to take the segment's trade. The filter does not change the segment chain.
DH filter rules (single line, /s0/ and s01)
| Rule | Entry allowed when |
|---|---|
| A | the last confirmed signal is a min (after min, until max) |
| A− | the last one is a max (control) |
| B | after a min, and the min was in the barrier |
| B− | after a min outside the barrier |
| C12 / C48 | after a min, ≤ 12 / 48 candles since confirmation |
| D / D− | s_abs is currently in / outside the barrier |
| E / E− | after a min, trade with / against the breakout (side: confirmation close vs the low's close) |
Two lines: DH S/M and Andrey's rule
The mamba Lab uses two lines, each with its own profile and STEP: S = 25 and M = 120 M5 candles, STEP M = 2.5 × STEP S (2.4–2.7 for the author). A star (SYNC_MIN) is an M min after a confirmed S min; an M max “resets” the series.
Andrey's rule (3 Nov 2026): an S low is confirmed in the barrier, S is still in the barrier, S crosses the barrier upward — signal. Meanwhile M confirms a low in the barrier, rises after the low, crosses the barrier, and keeps rising towards a high. S and M highs are not used as signals.
DH 1H scanner: ready / ripening / pause
Andrey's idea (6 Nov): the market moves from compression to expansion; an instrument is “ready” when M is near its low and S is near its low or breaking out into a signal. Windows S 50 / M 250 on H1. “Ready” puts the instrument on the watchlist, while entries come from the DH filters on M5.
- READY — S bounces 2·STEP off a low in the barrier, and M ≤ B1 + buffer now or ≤ 24 candles ago;
- PAUSE — an M max is confirmed; or M is at its statistical high and an S max is confirmed in the B7+ zone;
- RIPENING ⟳ — after “ready”, S is back in the barrier and M is in its own barrier (draft).
Versions and windows
| Where | Windows | TF |
|---|---|---|
| DH-Levels v0.1, cryptotrader (September) | 5m 20/60/120 · 1h 10/35/70 · 4h 10/25/60 · 1d 5/10/15; width in %, compressed flag | 5m–1d |
Author's dh_dynamics.py | 5M 5/15/45 … 1W 2/3/8 | any |
Author's dh_analyze.py, /s0/, s01 | 45/70/120, signals from S only | M5 |
| mamba Lab “DH S/M” | S 25 / M 120, each with its own signals | M5 |
| DH 1H / dh_state | S 50 / M 250 | H1 |
25/120 has a rationale: a plateau at S = 20…25, no effect at S = 12, 15 and 45. In cryptotrader DH-Levels are “frozen” at candle i−1, while the author uses the current candle (logged as a discrepancy).
What the tests showed
| Test | Result |
|---|---|
| MOEX 5m, 31 Aug – 19 Oct | No direction: expansion after a min goes up and down equally. After a barrier min the range is 1.6–1.9× the background, but adjusted for hour of day it is 0.99–1.16. |
| BTC 5m, 108 S0 trades, STEP 400 | All +0.376 R; A +0.355; B +0.404; E− +0.721 (26 trades). No rule went beyond chance. |
| Lab, 10 instruments, 5,664 trades | Baseline −0.163 R; “S min confirmed in the barrier, S still in the barrier” +0.180 (433 trades, 8/9 instruments); + M in the lower half +0.228. After correcting for the number of rules, p ≈ 0.14–0.24. |
| Andrey's rule, 2 Sep – 2 Nov | 44 real trades, +0.234 R, win rate 40.9% (baseline 2,869, −0.124 R). In forward test. |
| Combined with the golden trend (D4) | “Anchor ≤ 3 candles + D4”: 79 trades, +0.644 R; D4 alone without the golden trend: +0.005 R. |
| #143, RTS + MIX | A2 “M min from the lower zone → big”: 48 trades, +1.23 R (in STEP M), p 0.011. |
Sources in the projects (12)
cryptotrader/src/dh-logic.html— best diagram: 6-step pipeline, profile, min/max automaton, rules A–Ecryptotrader/research/dh/STUDY.md— indicator study on MOEX 5mcryptotrader/research/dh/FILTER.md— filter on BTC 5mcryptotrader/research/dh/vendor/DH_signals_patch_20261019/dhcore/— author's reference: width.py, profile.py, extremes.pycryptotrader/docs/DH_PARITY.md— DH-Levels parity with the author: 6253 numbers, zero differencecryptotrader/src/s0/dh.js— filter on /s0/: rules A…E−cryptotrader/step_prot/dh_state/— DH 1H status scanner: ready / ripening / pausemamba/s01/s01/dh.py— s01 DH filtermamba/lab/platform/s01/dhsm.py— DH S/M: two lines, starsmamba/lab/research/dh_filter/forward/RULE.md— Andrey's two-line rule (3 Nov) and rule Bmamba/lab/research/dh_filter/DH_filter_45.md— filter on 10 instruments, 5664 tradesmamba/lab/DH_1H/call-06.11-07.08/summary.md— Andrey's H1 review, 6 Nov