OPEN-SOURCE SCRIPT
Laguerre RSI [RC Tools]

RC Tools — Laguerre RSI
────────────────────────────────────────────────────────────────────
█ OVERVIEW
Standard RSI computes gains and losses over a fixed lookback window, which means its reading is partly a function of what happens to fall in and out of that window as bars roll forward — not just what price is actually doing. John Ehlers' Laguerre RSI replaces the fixed window entirely with a 4-stage recursive filter, producing a bounded oscillator that is smoother and reacts with meaningfully less lag than a standard RSI at a comparable responsiveness.
█ WHAT IT DOES
Runs price through a 4-stage Laguerre filter cascade and computes an RSI-style ratio from the up/down relationships between adjacent filter stages, producing a bounded 0-1 oscillator. Classifies each confirmed bar as Bullish or Bearish on a midline (0.5) crossover, colours the chart background accordingly, plots the oscillator against reference Overbought/Oversold lines, and shows a table with the live (intrabar) and confirmed vote side by side, plus how long price has been in the current state.
█ THE THEORY BEHIND IT
A standard RSI's behaviour is tied to its lookback window: a sharp move several bars ago can still be influencing today's reading, right up until it falls out of the window, at which point the reading can shift even if nothing happened today. Ehlers' insight was to replace the fixed window with a Laguerre filter — a cascade of stages related to all-pass filters, each one a damped combination of the current and prior stage — controlled by a single damping factor rather than a lookback length. The RSI-style up/down ratio is then computed across the filter's own stages rather than across historical bars, which is what gives Laguerre RSI its smoother, faster-reacting character relative to a standard RSI.
█ HOW IT IS CALCULATED
1. Run price through four cascaded Laguerre stages (L0 through L3), each a damped recursive combination of the current input and the prior bar's stage values, controlled by the damping factor gamma.
2. For each of the three adjacent stage pairs (L0/L1, L1/L2, L2/L3), add the positive difference to a cumulative-up total (CU) if the earlier stage is greater or equal, otherwise add the difference to a cumulative-down total (CD).
3. Laguerre RSI = CU / (CU + CD), bounded 0 to 1.
4. The state classification uses a midline (0.5) crossover: LRSI crossing above 0.5 is classified Bullish, crossing below is classified Bearish. Between crossovers, the classification holds. The plotted Overbought/Oversold lines are reference context only and do not drive this classification.
Classification occurs ONLY on confirmed bar close — the plotted LRSI value, the background colour and the table all update together, so nothing here can disagree mid-bar or flip back and forth as the current bar forms.
█ SETTINGS & CONFIGURATION
• Source (default close)
• Damping Factor / gamma (default 0.5, Ehlers' classical value) — higher is smoother and slower, lower is faster and noisier
• Overbought / Oversold Levels (default 0.85 / 0.15) — reference lines only, plotted for context
• Table visibility, position and colours are fully configurable; the main-chart background painting can be toggled off if you only want the statistics pane
█ HOW TO USE IT
Use it as a smoother, lower-lag alternative to a standard RSI for gauging momentum state, not as a standalone entry signal. The Overbought/Oversold reference lines can be used the way you'd use classic RSI bands — as a visual cue for stretched conditions — even though they don't drive the Bullish/Bearish classification itself. The Live row can still change until the bar closes; only the Confirmed row is safe to treat as settled.
Works on any asset and timeframe.
█ LIMITATIONS
• Laguerre RSI is a BOUNDED 0-1 oscillator, not a magnitude measure. Any use of it as a precision reversal forecast is a misuse.
• The classification here is driven by the midline (0.5) crossover, not the plotted Overbought/Oversold levels — those are reference lines only.
• The damping factor (gamma) trades responsiveness for smoothness just like a lookback length would in a standard RSI; there is no single correct value for every asset or timeframe.
• Because the filter replaces a fixed lookback with recursive stages, it has no hard "warm-up window" the way a standard RSI does — early bars converge gradually rather than becoming reliable at a fixed bar count.
• This script does NOT repaint. All classification updates on confirmed bar close only.
█ DISCLAIMER
For educational and informational purposes only. Nothing here is financial advice. Past behaviour of any momentum state does not indicate future results. Trade at your own risk.
────────────────────────────────────────────────────────────────────
█ OVERVIEW
Standard RSI computes gains and losses over a fixed lookback window, which means its reading is partly a function of what happens to fall in and out of that window as bars roll forward — not just what price is actually doing. John Ehlers' Laguerre RSI replaces the fixed window entirely with a 4-stage recursive filter, producing a bounded oscillator that is smoother and reacts with meaningfully less lag than a standard RSI at a comparable responsiveness.
█ WHAT IT DOES
Runs price through a 4-stage Laguerre filter cascade and computes an RSI-style ratio from the up/down relationships between adjacent filter stages, producing a bounded 0-1 oscillator. Classifies each confirmed bar as Bullish or Bearish on a midline (0.5) crossover, colours the chart background accordingly, plots the oscillator against reference Overbought/Oversold lines, and shows a table with the live (intrabar) and confirmed vote side by side, plus how long price has been in the current state.
█ THE THEORY BEHIND IT
A standard RSI's behaviour is tied to its lookback window: a sharp move several bars ago can still be influencing today's reading, right up until it falls out of the window, at which point the reading can shift even if nothing happened today. Ehlers' insight was to replace the fixed window with a Laguerre filter — a cascade of stages related to all-pass filters, each one a damped combination of the current and prior stage — controlled by a single damping factor rather than a lookback length. The RSI-style up/down ratio is then computed across the filter's own stages rather than across historical bars, which is what gives Laguerre RSI its smoother, faster-reacting character relative to a standard RSI.
█ HOW IT IS CALCULATED
1. Run price through four cascaded Laguerre stages (L0 through L3), each a damped recursive combination of the current input and the prior bar's stage values, controlled by the damping factor gamma.
2. For each of the three adjacent stage pairs (L0/L1, L1/L2, L2/L3), add the positive difference to a cumulative-up total (CU) if the earlier stage is greater or equal, otherwise add the difference to a cumulative-down total (CD).
3. Laguerre RSI = CU / (CU + CD), bounded 0 to 1.
4. The state classification uses a midline (0.5) crossover: LRSI crossing above 0.5 is classified Bullish, crossing below is classified Bearish. Between crossovers, the classification holds. The plotted Overbought/Oversold lines are reference context only and do not drive this classification.
Classification occurs ONLY on confirmed bar close — the plotted LRSI value, the background colour and the table all update together, so nothing here can disagree mid-bar or flip back and forth as the current bar forms.
█ SETTINGS & CONFIGURATION
• Source (default close)
• Damping Factor / gamma (default 0.5, Ehlers' classical value) — higher is smoother and slower, lower is faster and noisier
• Overbought / Oversold Levels (default 0.85 / 0.15) — reference lines only, plotted for context
• Table visibility, position and colours are fully configurable; the main-chart background painting can be toggled off if you only want the statistics pane
█ HOW TO USE IT
Use it as a smoother, lower-lag alternative to a standard RSI for gauging momentum state, not as a standalone entry signal. The Overbought/Oversold reference lines can be used the way you'd use classic RSI bands — as a visual cue for stretched conditions — even though they don't drive the Bullish/Bearish classification itself. The Live row can still change until the bar closes; only the Confirmed row is safe to treat as settled.
Works on any asset and timeframe.
█ LIMITATIONS
• Laguerre RSI is a BOUNDED 0-1 oscillator, not a magnitude measure. Any use of it as a precision reversal forecast is a misuse.
• The classification here is driven by the midline (0.5) crossover, not the plotted Overbought/Oversold levels — those are reference lines only.
• The damping factor (gamma) trades responsiveness for smoothness just like a lookback length would in a standard RSI; there is no single correct value for every asset or timeframe.
• Because the filter replaces a fixed lookback with recursive stages, it has no hard "warm-up window" the way a standard RSI does — early bars converge gradually rather than becoming reliable at a fixed bar count.
• This script does NOT repaint. All classification updates on confirmed bar close only.
█ DISCLAIMER
For educational and informational purposes only. Nothing here is financial advice. Past behaviour of any momentum state does not indicate future results. Trade at your own risk.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.