Squeeze Regime Map [BSL]Squeeze Regime Map classifies volatility contraction, confirmed release and
directional expansion as explicit states. It answers “what volatility regime
is the current chart in?”, not “what trade should I take?”
This is an original BarState Labs implementation built from an independent
written specification. It does not reproduce another publication's formula,
defaults, interface, chart grammar or source code.
HOW IT WORKS
Normalized volatility is Wilder ATR divided by close and expressed as a
percentage:
`nATR = RMA(True Range, ATR length) / close × 100`
The current nATR is ranked inside the latest complete rolling window using an
inclusive percentile:
`VOL PCTL = 100 × count(window values <= current nATR) / window size`
Inclusive ties are deliberate. The implementation uses this explicit bounded
definition rather than relying on an opaque rank function.
Directional impulse is displacement over the selected momentum length,
normalized by current ATR and then EMA-smoothed:
`impulse = EMA((close - close ) / ATR, smoothing)`
Impulse labels the direction of a confirmed release only when its magnitude is
at least the configured minimum. A weak release is recorded as unresolved
instead of being forced up or down.
STATE MACHINE
- Compression begins when VOL PCTL is at or below the compression-entry level.
- Compression persists until the separate release threshold is reached. This
hysteresis prevents repeated threshold chatter.
- The first qualified exit is a one-bar Release Up or Release Down state and a
one-bar +1 or -1 machine-readable pulse.
- A weak exit returns to Neutral and increments the unresolved ledger.
- On the next bar, a directional release becomes Expansion only when volatility
reaches the expansion threshold and impulse keeps the same qualified
direction.
- Expansion persists while volatility remains above the release threshold and
direction agrees. Otherwise the state returns to Neutral.
- A new compression always takes transition precedence.
The default thresholds are 20 / 40 / 70 percentile. They must satisfy
`compression < release <= expansion`; an invalid order renders `CONFIG ERROR`
and freezes committed output until corrected.
CONFIRMED-BAR BEHAVIOR
State, duration, release plots, diagnostics and alert pulses commit only on
confirmed bars. On an open realtime bar, the panel says `OPEN BAR — HELD` and
retains the previous confirmed values. Historical, elapsed realtime and Bar
Replay bars use the same transition order.
This does not prevent upstream exchange or broker feed corrections from
changing rebuilt history after reload. The script makes no external data
requests and uses only the current chart symbol and timeframe.
OUTPUTS
The pane contains:
- volatility percentile and declared threshold guides;
- a visually clipped impulse histogram;
- optional confirmed regime backgrounds;
- optional confirmed release markers;
- Compact and Full evidence panels with state, duration, normalized metrics,
release counts, unresolved events and readiness.
Hidden machine-readable plots expose:
- Regime code: -3, -2, 0, 1, 2 or 3;
- Compression score: 100 minus VOL PCTL;
- Confirmed release: +1, -1 or 0.
The Confirmed release plot can be selected directly as Signal Audit Lab's
Event source with the Signed pulse decoder. In the validation run, BSL-002's
18 up and 19 down releases matched BSL-001's 18 long and 19 short accepted
events exactly.
ALERTS
Four alert conditions are provided:
- Confirmed volatility release up;
- Confirmed volatility release down;
- Confirmed directional expansion up;
- Confirmed directional expansion down.
Release alerts use the same one-bar booleans as the exported pulse. Expansion
alerts fire only on entry into expansion.
LIMITATIONS
- This is a regime classifier, not a forecast, entry/exit system or strategy.
- A release direction is a normalized momentum label, not evidence of future
return.
- Percentile and state depend on the loaded symbol, timeframe, feed, history
and settings.
- Warm-up requires a complete percentile window and valid momentum history.
- The maximum 500-value percentile window is bounded but intentionally more
expensive than the default 126-value window.
- No optimization, multi-symbol scan, multi-timeframe request, order model,
position sizing or profitability claim is included.
VALIDATION
The release candidate passed 14 deterministic reference tests, a 14/14 live
Pine harness, BTCUSDT/AAPL × 1D/1H runtime checks, exact reload parity,
realtime and replay gates, valid/invalid threshold boundaries, four alert
conditions, 390 px rendering, BSL-001 signed-source integration and a 32,137
execution Profiler run at the maximum 500-bar window.
ORIGINALITY AND SOURCE
Category demand was selected from a dated metadata corpus. No protected,
invite-only or closed source was accessed, and no source from a compared open
publication was imported. The script uses standard true-range, Wilder RMA,
percentile-count and EMA calculations and is released under MPL 2.0.
CHANGELOG
v1.0.0
- Initial open-source release candidate.
- Explicit compression, release and expansion state machine with hysteresis.
- Inclusive rolling volatility percentile and normalized directional impulse.
- Confirmed +1 / -1 release export for Signal Audit Lab.
- Compact/Full evidence panels, four alerts and visible limitations.
Chỉ báo






















