Anchored LRC Pro+

Anchored LRC Pro+ is a linear regression channel that intelligently anchors to Williams Fractal pivot points on the price chart. Instead of using a fixed lookback length like standard regression channels, this indicator evaluates recent fractal pivots and selects the statistically optimal anchor point using Pearson’s R correlation coefficient. The result is a regression channel that is always anchored to real market structure — a confirmed swing high or swing low — rather than an arbitrary number of bars. Includes independent BUY/SELL fractal signals, AGAIG price pivot turns with intra-bar preview, slope direction coloring, price position tracking within the channel, and band touch alerts.
WHAT IT DOES
Anchored LRC Pro+ provides three layers of analysis on the price chart:
•Smart-Anchored Regression Channel — A linear regression channel drawn from a fractal pivot point to the current bar. Four anchor modes are available: Best Fit (Pearson R) automatically evaluates up to 10 recent fractals and selects the one that produces the highest correlation coefficient, creating the most statistically valid channel. Most Recent anchors from the latest fractal regardless of fit quality. From Fractal High and From Fractal Low force the anchor to the most recent pivot high or low specifically. The channel displays a center regression line, upper band, and lower band at a configurable standard deviation width, with optional right-side extension. Slope direction coloring turns the regression line green for bullish (upward) slope and red for bearish (downward) slope.
•Independent Signal Fractals with BUY/SELL Labels — Williams Fractal pivot detection with its own configurable lookback period, completely independent from the anchor fractal lookback. This separation allows traders to use tight fractals (n=2) for fast BUY/SELL signal generation while the channel anchoring system uses wider fractals (n=5+) for structural stability. Fractal highs produce SELL labels, fractal lows produce BUY labels. Both arrows and labels are independently toggleable with configurable size and colors. Auto-detection adjusts the lookback period to the chart timeframe when set to 0 (1-2min: 10, 5min: 7, 15min: 5, 1H+: 2-3). Non-repainting.
•AGAIG Turns with Confirm/Preview — Confirmed price pivot highs and lows using left-only detection (no right-side bar confirmation required), producing signals with significantly less lag than Williams Fractals. Two signal modes: Confirm Only locks the pivot label at bar close for maximum reliability. Confirm + Preview shows semi-transparent preview labels intra-bar (marked with tildes: ~ BUY ~ / ~ SELL ~) that update in real-time as price moves, then lock into solid confirmed labels when the bar closes. Preview labels automatically delete and redraw each tick so they never persist as false signals. This gives traders early warning of potential pivots while clearly distinguishing confirmed from unconfirmed signals.
HOW IT WORKS
The anchor fractal system detects Williams Fractal pivot highs and lows using ta.pivothigh and ta.pivotlow with a configurable lookback period. Each confirmed fractal is stored in an array (up to the configured evaluation count). In Best Fit mode, the Pearson R correlation coefficient is calculated from each stored fractal to the current bar by computing the linear relationship between bar index and close price over that range. The fractal producing the highest absolute R value (above the minimum threshold) becomes the anchor point. This ensures the channel is drawn along the path of strongest linear trend from a real structural pivot.
The linear regression is computed from the anchor bar to the current bar using least-squares method. Slope and intercept define the center line. Standard deviation of price from the regression line defines the channel width at the configured multiplier (default 2.0). The channel extends rightward by a configurable number of bars to project the trend forward. Price position within the channel is calculated as a percentage (0% = lower band, 50% = regression line, 100% = upper band) and displayed in the info table with zone labels (Lower Extreme, Lower Zone, Below Mid, Midline, Above Mid, Upper Zone, Upper Extreme).
Signal fractals operate on a completely separate lookback period from anchor fractals. Both use the same Williams Fractal algorithm but with independent n-values. This dual-fractal architecture means signal timing and channel structure are decoupled — changing one does not affect the other.
AGAIG turns use ta.pivothigh(high, n, 0) and ta.pivotlow(low, n, 0) — checking n bars to the LEFT only with zero right-side confirmation. This produces faster pivot detection than Williams Fractals which require n bars on BOTH sides. In Preview mode, the pivot is evaluated intra-bar (before the bar closes), producing a semi-transparent label that updates in real-time. Once the bar closes, barstate.isconfirmed locks the label as a solid confirmed signal. Preview labels are deleted and recreated each tick to prevent orphaned false signals.
HOW TO USE IT
•Channel as Trend Context: The regression channel provides the structural trend framework. Trade in the direction of the slope (green = bullish bias, red = bearish bias). Use the price position percentage to gauge where price sits within the channel — entries near the lower band in an uptrend or upper band in a downtrend offer the best risk/reward.
•Signal Fractals for Entry Timing: BUY labels at fractal lows and SELL labels at fractal highs provide discrete entry signals. These work best as confluence signals — a BUY fractal near the lower regression band in a bullish channel is a high-probability long setup. Set the signal fractal lookback independently from the anchor to tune signal frequency without affecting channel structure.
•AGAIG Preview for Early Warning: Enable Confirm + Preview mode for the fastest possible pivot detection. The semi-transparent ~ BUY ~ and ~ SELL ~ labels appear intra-bar, giving you advance notice of a forming pivot. Wait for the label to lock solid (bar close) for confirmation, or use the preview as a heads-up to prepare your order. AGAIG turns combined with channel position create strong confluence entries.
•Band Touch as Extreme Alerts: Set alerts on upper and lower band touches. Price reaching the upper band in a bullish channel may indicate trend acceleration or exhaustion depending on momentum. Price reaching the lower band in a bullish channel is a potential pullback entry zone. The Price Position field in the info table shows real-time proximity to bands.
•Anchor Mode Selection: Best Fit (Pearson R) is recommended for most situations — it automatically finds the strongest trend from recent structure. Use From Fractal High when you specifically want the channel anchored from a swing high (useful in downtrends). Use From Fractal Low for uptrend channels from a swing low. Most Recent is a simple last-fractal anchor without fit optimization.
KEY SETTINGS
Setting Description
Signal Fractal Lookback 0 = Auto. Controls BUY/SELL signal labels. Independent from anchor fractals.
Anchor Fractal Lookback 0 = Auto. Controls which fractals feed the channel anchor search. Independent from signal fractals.
Anchor Mode Best Fit (Pearson R), Most Recent, From Fractal High, From Fractal Low.
Fractals to Evaluate Default 5. How many recent anchor fractals to compare in Best Fit mode (2-10).
Minimum R Threshold Default 0.0. Reject anchor candidates below this correlation value (0-0.9).
AGAIG Pivot Length Default 5. Bars to the left for pivot detection. No right-side confirmation = less lag.
Signal Mode Confirm Only or Confirm + Preview. Preview shows intra-bar labels before bar close.
Channel Width (StdDev) Default 2.0. Standard deviation multiplier for upper/lower bands.
Slope Coloring On by default. Green regression line for bullish slope, red for bearish.
Extend Right Default 10 bars. Projects the channel forward beyond the current bar.
ALERTS
Six alert conditions are available:
•Fractal High (SELL) / Fractal Low (BUY) — Signal fractal confirmations
•AGAIG Pivot High (SELL) / AGAIG Pivot Low (BUY) — Confirmed AGAIG pivots
•Upper Band Touch / Lower Band Touch — Price reaches channel extremes
INFO TABLE
A configurable dashboard displays real-time channel data:
•Anchor type (Fractal High or Fractal Low) with color coding
•Pearson R value with strength rating (Very Strong / Strong / Moderate / Weak)
•Channel length in bars
•Slope direction (Bullish / Bearish) with color coding
•Price position as percentage with zone label (Lower Extreme through Upper Extreme)
NOTES
•Non-repainting. Signal fractals and AGAIG confirmed pivots use closed-bar data only. AGAIG Preview labels update intra-bar and are clearly marked as unconfirmed.
•Dual-fractal architecture: signal fractal lookback and anchor fractal lookback are completely independent. Changing one does not affect the other.
•AGAIG turns produce faster signals than Williams Fractals because they use left-only detection (no right-side confirmation bars required).
•Best Fit (Pearson R) mode automatically selects the most statistically valid channel from recent market structure. No manual anchor selection needed.
•Channel only renders on the current (rightmost) bar for performance. Designed as a live trading tool, not a backtesting overlay.
•All visual elements (fractals, labels, AGAIG, channel, info table) are independently toggleable.
•Auto-detection adjusts fractal lookback to timeframe when set to 0 — works across scalping to swing timeframes without manual adjustment.
•Pine Script v6 compatible. Protected source.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Intelligent Linear Regression Channel with Fractal-Based Anchoring, Pearson R Optimization & AGAIG Pivot Detection
OVERVIEW
Traditional Linear Regression Channels use a fixed lookback period — 50 bars, 100 bars, 200 bars. These arbitrary periods rarely align with actual market structure. Anchored LRC Pro+ solves this by anchoring the regression channel to confirmed Williams Fractal pivot points, then using Pearson’s R correlation to select the statistically optimal anchor from multiple candidates. The result is a channel that starts from a real structural turning point, not an arbitrary bar.
ANCHOR MODES (8 options)
1.Best Fit (Pearson R): Evaluates all recent fractals (high and low) and selects the one with the strongest R correlation. Fully automatic.
2.Best Fit High / Best Fit Low: Same Pearson R optimization, but constrained to only fractal highs or lows. Use Best Fit High in downtrends, Best Fit Low in uptrends.
3.Highest High / Lowest Low: Finds the absolute highest or lowest price in a configurable lookback window (50–1200 bars). No fractal detection needed. Ideal for macro channels that anchor to dominant peaks or valleys.
4.Most Recent: Anchors to the most recent confirmed fractal regardless of R value.
5.From Fractal High / From Fractal Low: Anchors to the most recent fractal high or low specifically. Manual control.
KEY FEATURES
•AGAIG Pivot Turns: Zero-lag pivot detection with Confirm and Preview modes. BUY/SELL labels at confirmed fractal pivots.
•Slope Direction Coloring: Regression line changes color based on slope direction for instant visual trend identification.
•Multi-Deviation Bands: Standard deviation channels at configurable width for mean reversion entries and exits.
•Anchor Info Label: Shows anchor price, Pearson R value, and price position within the channel.
•Channel Band Touch Alerts: Built-in alert conditions for upper and lower band touches, plus AGAIG BUY/SELL pivots and fractal confirmations.
•Dual Instance Support: Run two LRC Pro+ on the same chart — one in Highest High mode for macro, one in Best Fit High for micro.
•Non-Repainting: Fractals require confirmation bars before becoming valid anchors. Historical signals do not change.
v1.3 — WHAT’S NEW
•Best Fit High / Best Fit Low anchor modes — Pearson R optimization constrained to fractal highs or lows only.
•Highest High / Lowest Low anchor modes — Finds absolute price extremes in a configurable lookback window (50–1200 bars). No fractal detection required.
•BUY/SELL labels independent of Fractal Markers — Show/hide labels and fractal dots separately.
•Fractals to Evaluate expanded — Default increased to 10, max raised to 30 for deeper anchor search.
v1.2:
AGAIG Turns with Confirm/Preview modes, slope direction coloring, channel band touch alerts, BUY/SELL fractal labels, consolidated single-pass Pearson R + regression calculation.
BEST FOR
Mean reversion trading, trend channel entries, and statistical support/resistance identification. Works on all instruments and timeframes. Particularly effective on micro futures (MNQ, MES, MYM, MGC, MCL) for scalping mean reversion setups within the channel.
ATTRIBUTION
Adaptive Trend Finder component © Julien_Eche (2023). Used under GPL-3.0 license with original code preserved.
For educational and informational purposes only. Not financial advice. Trading involves substantial risk of loss. Past performance does not guarantee future results.
Script sob convite
Somente usuários aprovados pelo autor podem acessar este script. Você precisará solicitar e obter permissão para usá-lo. Normalmente, essa permissão é concedida após o pagamento. Para obter mais detalhes, siga as instruções do autor abaixo ou entre em contato diretamente com NPR21.
A TradingView NÃO recomenda pagar ou usar um script, a menos que você confie totalmente em seu autor e entenda como ele funciona. Você também pode encontrar alternativas gratuitas e de código aberto em nossos scripts da comunidade.
Instruções do autor
Aviso legal
Script sob convite
Somente usuários aprovados pelo autor podem acessar este script. Você precisará solicitar e obter permissão para usá-lo. Normalmente, essa permissão é concedida após o pagamento. Para obter mais detalhes, siga as instruções do autor abaixo ou entre em contato diretamente com NPR21.
A TradingView NÃO recomenda pagar ou usar um script, a menos que você confie totalmente em seu autor e entenda como ele funciona. Você também pode encontrar alternativas gratuitas e de código aberto em nossos scripts da comunidade.