range locates the most recent tight horizontal consolidation bounded by an ATR height cap, tracks wick or multi-bar deviations that reclaim inside the range, and detects sustained breakouts.
Parameters
| Parameter | Default | Range | Type | Timeframe overrides |
|---|---|---|---|---|
window |
500 |
60..2000 |
integer | — |
maxHeightAtr |
4 |
1..15 |
number | — |
minBars |
12 |
5..300 |
integer | 8 on >= 1d |
lookback |
200 |
20..2000 |
integer | — |
Algorithm & Nuances
- Backward box growth (
rangeScan): Walks end barebackward fromn - 1down tomax(minBars - 1, n - 1 - lookback). For eache, extends startstbackward whilemaxH - minL <= maxHeightAtr * atr[e]. Selects the most recentespanning at leastminBars. - Boundary touches: Counts distinct touches of
highandlowwithin0.25 * atr[e]separated by at leastTOUCH_GAP = 3bars. - Deviation & reclaim tracking: Scans forward after
efor fakeout excursions up to1.5 * atr[k]:- Wick deviation: Single candle wicking
>= 0.2 * atr[k]outside[low, high]and closing back inside extends the range right edgeeand logs aDeviation. - Multi-bar reclaim: Close outside
[low, high]that reclaims back inside within1–3bars (with max excursion<= 1.5 * atr[k]) extendseto the reclaim bar and logs aDeviation. - Caps recorded deviations at
4.
- Wick deviation: Single candle wicking
- Status & compression:
- Status is
'active'whene === n - 1,'broke up'or'broke down'on a sustained close outside (withbreakTime), or'left'if the box ended without an active close beyond bounds. compression = mean(atr[st..e]) / mean(atr[max(0, st - 14)..st - 1])quantifies volatility contraction entering the box.
- Status is
Drawings & Facts
- Drawings:
0or1zonebox in'accent'tone with a dashed 50% midpoint line (mid) and right-edge tags (Range high,Range low), plus up to4marklabels (Dev ↓above /'down',Dev ↑below /'up'). - Facts (
RangeFacts):box(from,to,high,low,mid,bars,heightAtr,status,breakTime,topTouches,bottomTouches,compression,positionInRange,deviations[]) ornull.
Activation
- Studies menu:
Range box(Range) - Slash command:
/range - Chat phrases:
range,ranges,box,consolidation