OPEN-SOURCE SCRIPT

Anchor S&R Suite - Parallel

417
Anchor S&R Suite — Parallel
A data-driven, zero-repaint parallel support/resistance grid built from the market's own swing pivots.

Instead of eyeballing a range and dragging parallel lines by hand, this indicator finds the swing pivots automatically, groups the ones that cluster at similar prices into support/resistance levels, picks the single strongest Resistance/Support pair, and repeats that channel's height up and down as an evenly-spaced grid — recomputed on a higher-time-frame (HTF) rhythm and held flat in between.


WHAT MAKES IT DIFFERENT

• Data-driven, not arbitrary. The channel is built from REAL swing pivots that actually printed. A level's weight comes from how many pivots cluster on it and how long they span — not from a hand-placed box.

• Anchored to a time frame. You set the cadence (e.g. Weekly); the channel recomputes once per closed HTF candle and stays perfectly flat until the next close — clean horizontal steps, not sloping lines.

• Zero repaint. Pivots are confirmed and only closed HTF periods are used. A level you saw earlier sits in the exact same place now. Warm-up is not repaint: if a period has too few qualifying levels, the previous channel simply CARRIES FORWARD — no past value is ever rewritten.


HOW IT WORKS

1. Pivots — confirmed swing highs/lows on your CHART bars (strength = Pivot Period).
2. Window — at each cadence close, keep the pivots from the last `Lookback` closed HTF periods.
3. Clustering — sort pivots by price and merge those within Cluster Tolerance (% of price) into one level, carrying its touch COUNT and time SPAN.
4. Best channel — among levels with at least Min Touches, pick the Resistance/Support pair with the highest score (see below), subject to the width filters.
5. Grid — repeat that channel's height up and down: price = resistance − height × j. The base channel (Resistance & Support) is highlighted; the lines above/below are projected S/R.


THE ALGORITHM

For every Resistance cluster R and Support cluster S with R.price > S.price and height H = R − S > 0:
width% = H / basis × 100 (basis = Support or Resistance — see Width Basis)
reject if width% < Min% or width% > Max% (0 disables that bound)
score = (R.count + S.count) × (R.span + S.span + 1)
→ keep the highest-scoring pair; if none qualifies, carry the previous channel forward.

Why that score: (count) rewards levels touched many times; (span) rewards levels respected over a long stretch. Multiplying them favours a channel whose BOTH edges are repeatedly AND durably defended.


SETTINGS

• Cadence TF — when the channel recomputes and how macro it is. Higher = fewer, wider, slower channels; lower = tighter, more reactive. Must be greater than the chart TF.

• Lookback (1–20) — how many closed HTF periods of pivots feed the search. More = steadier, better-tested channel; less = tracks the latest swing but can be noisier or carry forward.

• Pivot Period — swing strength: a pivot needs this many bars on each side. Higher = bigger, fewer, more significant swings; lower = finer, busier levels. (A pivot is confirmed `period` bars after it forms — a delay, not repaint.)

• Price Source — High/Low (wicks, true extremes) or Open/Close (bodies only, cleaner on wick-heavy assets).

• Cluster Tolerance % — how close two pivots must be to count as the same level. Larger = fewer, fatter, better-touched levels; smaller = more, thinner levels (which may fall below Min Touches).

• Min Touches — minimum pivots in a cluster to qualify as a level. Higher = only well-tested levels (more robust, fewer candidates); lower = looser.

• Min / Max Channel Width % (+ Width Basis) — a FILTER on which R/S pairs are allowed, by channel height as a percentage. It does not resize a channel; it decides how tall the chosen one may be (and therefore the grid spacing).
width% = height / basis × 100, with basis = Support (“Bottom to Top”) or Resistance (“Top to Bottom”).
Example: R = 70 000, S = 63 000 → height 7 000 → 11.1% (Bottom to Top) or 10.0% (Top to Bottom).
Raise Min → forces a taller channel / wider grid; lower Max → forces a shorter channel / tighter grid; 0 = bound off. If the band is too strict, no pair passes and the channel carries forward.

istantanea
Lookback = 1 (reactive) vs Lookback = 3 (broader, steadier).

• Parallel Lines (per side) — how many grid repeats are drawn above/below the base channel (total = 2 × N + 1). Coverage only.

• Display — colour & width for the Grid and the Base channel, and optional channel-height % labels.

istantanea
The base channel (bold Resistance / Support) with the % labels on, and the lighter grid repeating around it.


HOW TO TRADE THE GRID

• Trade reactions, not the line itself — watch for a rejection, reclaim or stall at a line rather than assuming it stops there.
• The base channel is the anchor: inside it = range conditions (fade the edges); a clean break-and-hold often runs to the next grid line (one channel height away).
• Grid spacing = a measured-move unit — the next line up/down is a natural first target after a breakout.
• Confluence first — a line matters most where it lines up with prior structure, a round number, or (with the rest of the suite) a Volume/OI zone or a Fib level.


EXAMPLE SETUPS

• Swing (default): 1h–4h chart, Cadence = Weekly, Lookback = 3, Pivot Period = 5.
• Intraday: 5–15m chart, Cadence = Daily, Lookback = 2–3, Pivot Period = 3–5.
• Macro: Daily chart, Cadence = Monthly, Pivot Period = 8–15.
Nothing showing? Raise Cluster Tolerance, then lower Min Touches, then widen the Min/Max width band, then increase Lookback.

Works on any market and any timeframe.

This indicator is a charting / analysis tool. It is not financial advice and does not generate buy or sell signals.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.