sr identifies horizontal support and resistance bands by clustering confirmed fractal swings around high-density price zones, weighted by recency, volume, wick rejection, and higher-scale swing confluence.
Parameters
| Parameter | Default | Range | Type | Timeframe overrides |
|---|---|---|---|---|
window |
500 |
60..2000 |
integer | — |
pivotSpan |
3 |
2..10 |
integer | 4 on <= 5m, 2 on >= 1d |
tolAtr |
0.35 |
0.05..2 |
number | — |
minTouches |
2 |
2..10 |
integer | — |
max |
5 |
1..12 |
integer | — |
halfLife |
0.33 |
0.05..2 |
number | — |
Algorithm & Nuances
- Multi-scale fractal pivots: Runs
fractalPivotsatpivotSpanand marks swings that also qualify atmajorSpan = min(10, pivotSpan * 2)(majorMask). - Per-touch weighting: Each swing touch receives weight
recency * vol * wickMult * majorMult:recency = halfWeight(n - 1 - at, halfLife * n)(exponential decay with half-life equal tohalfLifefraction of the window).vol = clamp(sqrt(v[at] / medVol), 0.5, 2)(1whenmedVol <= 0).wickMult = 0.85 + 0.5 * wickFrac(upper wick ratio on swing highs, lower wick ratio on swing lows).majorMult = 1.6if the swing is also a major pivot, else1.0.
- Density-peak greedy clustering: Sorts swings by price and repeatedly selects the unconsumed window
[start, start + 2 * tol](tol = atr[n - 1] * tolAtr) with at leastminTouchesswings and maximum total weight. Consumes its members and computes the weighted mean priceL. - Dynamic-ATR crossings & role flip: Walks forward from the first touch to
n - 1using per-bar toleranceatr[k] * tolAtr. Counts close switches across[L - barTol, L + barTol].role = lastClose >= L ? 'support' : 'resistance'.status = 'holding'whencrossings === 0;'flipped'when a touch afterlastCrossretests from the new side;'broken'otherwise.
- Scoring & strength:
score = r2(weight / (1 + 0.5 * crossings) / (1 + distAtr / 8)).strength = 'strong'if unbroken and (majorTouches >= 2ortouches >= 4 && score >= 2);'moderate'if unbroken and (majorTouches >= 1ortouches >= 3); else'weak'.
- Selection guarantee: Reserves slots for the highest-scoring non-broken support and non-broken resistance first, fills remaining slots up to
maxby descendingscore, and outputs sorted descending by price.
Drawings & Facts
- Drawings: Up to
maxbandoverlays spanning[L - tol, L + tol]with center lineL. Broken levels render'faint'in'neutral'tone with their original role label (Broken S/Broken R); holding and flipped levels render'up'(support) or'down'(resistance). - Facts (
SrFacts):atr,lastClose, andlevels[]containingprice,role,status,touches,majorTouches,touchTimes,lastTouchTime,crossings,band,distanceAtr,strength, andscore.
Activation
- Studies menu:
Support and resistance(S/R) - Slash command:
/sr - Chat phrases:
support,resistance,s/r,levels,horizontals