BASEtrading knowledge base
RU

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

Price squeezes into a narrow corridor, the DH line drops into the yellow zone, then price breaks out and DH rises Price Corridor width (DH) quiet zone (the “barrier”) spring squeezed quietest point “it's awake!” — signal
Top: price darts around, then squeezes into a narrow corridor, then shoots off. Bottom: DH drops into the yellow quiet zone, and when the corridor gets noticeably wider again, it gives a signal.

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.”

The DH author's chart: RTS price with signal triangles on top, the width line below, yellow bands for the quiet zone
A real chart from the indicator's author. Top: price (the RTS index future). Bottom: the DH line. Yellow bands show when the market is “quiet”. The circles are the lows and highs it found.

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

  1. 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.
  2. 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.
  3. 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.
  4. 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 than min_bars (3) are discarded.
  5. 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.
  6. 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.
RI5M, the author's DH-analysis: price with signal triangles, s_abs with B0…B8 levels and the yellow barrier zone, min/max circles labelled with their zone
RI5M, the author's DH-analysis (S = 45, STEP 120, k = 2, 17 signals). Bottom: s_abs, profile levels B0…B8, yellow zone — s_abs in [B0, B1 + R/16]; circles are min/max with their zone (AT_B0, IN_BARRIER, BELOW_B6).

DH filter rules (single line, /s0/ and s01)

RuleEntry allowed when
Athe last confirmed signal is a min (after min, until max)
A−the last one is a max (control)
Bafter a min, and the min was in the barrier
B−after a min outside the barrier
C12 / C48after 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

WhereWindowsTF
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 flag5m–1d
Author's dh_dynamics.py5M 5/15/45 … 1W 2/3/8any
Author's dh_analyze.py, /s0/, s0145/70/120, signals from S onlyM5
mamba Lab “DH S/M”S 25 / M 120, each with its own signalsM5
DH 1H / dh_stateS 50 / M 250H1

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

TestResult
MOEX 5m, 31 Aug – 19 OctNo 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 400All +0.376 R; A +0.355; B +0.404; E− +0.721 (26 trades). No rule went beyond chance.
Lab, 10 instruments, 5,664 tradesBaseline −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 Nov44 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 + MIXA2 “M min from the lower zone → big”: 48 trades, +1.23 R (in STEP M), p 0.011.
s01 RTS: segment chart, s_abs panel, filter strip and the “DH entry filter A…E−” card
s01, RTS: segments, the s_abs panel and the “DH entry filter A…E−” card.
Sources in the projects (12)
  • cryptotrader/src/dh-logic.html — best diagram: 6-step pipeline, profile, min/max automaton, rules A–E
  • cryptotrader/research/dh/STUDY.md — indicator study on MOEX 5m
  • cryptotrader/research/dh/FILTER.md — filter on BTC 5m
  • cryptotrader/research/dh/vendor/DH_signals_patch_20261019/dhcore/ — author's reference: width.py, profile.py, extremes.py
  • cryptotrader/docs/DH_PARITY.md — DH-Levels parity with the author: 6253 numbers, zero difference
  • cryptotrader/src/s0/dh.js — filter on /s0/: rules A…E−
  • cryptotrader/step_prot/dh_state/ — DH 1H status scanner: ready / ripening / pause
  • mamba/s01/s01/dh.py — s01 DH filter
  • mamba/lab/platform/s01/dhsm.py — DH S/M: two lines, stars
  • mamba/lab/research/dh_filter/forward/RULE.md — Andrey's two-line rule (3 Nov) and rule B
  • mamba/lab/research/dh_filter/DH_filter_45.md — filter on 10 instruments, 5664 trades
  • mamba/lab/DH_1H/call-06.11-07.08/summary.md — Andrey's H1 review, 6 Nov