Laguerre RSI: gamma, levels and TradingView examples
Laguerre RSI measures the balance of upward and downward differences between four recursive filter stages. Gamma controls how much past state remains in the calculation. Higher gamma generally responds more slowly; a faster setting does not establish better trading results.
Use the formula, startup example and same-sequence RSI comparison below to check a script before interpreting its 80/20 crossings.
Inspect the Pine Script exampleThe formula compares filter stages
Let P be the selected price source and [1] mean the previous bar. Calculate each current stage in order, because L1 uses the current L0, L2 uses the current L1, and L3 uses the current L2.
L0 = (1 - gamma) * P + gamma * L0[1]
L1 = -gamma * L0 + L0[1] + gamma * L1[1]
L2 = -gamma * L1 + L1[1] + gamma * L2[1]
L3 = -gamma * L2 + L2[1] + gamma * L3[1]
D0 = L0 - L1; D1 = L1 - L2; D2 = L2 - L3
CU = max(D0, 0) + max(D1, 0) + max(D2, 0)
CD = max(-D0, 0) + max(-D1, 0) + max(-D2, 0)
Laguerre RSI = 100 * CU / (CU + CD)These are differences across stages on one bar, not a sum of recent close-to-close gains. CU and CD are nonnegative, so a defined ratio lies between 0 and 100. If their total is zero, there is no ratio to interpret.
Formula references: MotiveWave Laguerre RSI and Sierra Chart Laguerre filter. The code below explicitly chooses its initialization and missing-value policy.
Gamma, alpha and the extreme cases
| Setting | Mechanism | Constraint |
|---|---|---|
| Gamma = 0 | After startup, the stages are P, P[1], P[2], P[3]. | A ratio of three price differences, not Wilder RSI(3). |
| 0 < gamma < 1 | More gamma means more feedback and longer persistence. | Threshold crossings can be delayed or repeated. |
| Gamma near 1 | The current price gets very little weight in L0. | Startup influence fades slowly; 100 bars may be insufficient. |
| Gamma = 1 | L0 stops accepting new price information. | Equal seeded stages stay equal. This example excludes 1. |
| Alpha = 1 - gamma | Alpha 0.2 is gamma 0.8; alpha 0.8 is gamma 0.2. | Check the formula before transferring a setting. |
The endpoint behavior follows directly from substituting gamma into the equations. This example restricts gamma to 0 through 0.99 for the conventional nonnegative smoothing use case. The upper input limit is a code choice, not an optimal trading parameter. A fixed gamma is not an adaptive filter.
Initialization changes the first readings
For a first price of 100, this script seeds all four stages at 100. CU and CD are then both zero, so the initial reading is missing. On the next bar, let price rise to 102 and gamma equal 0.5.
Previous stages: 100, 100, 100, 100
Current stages: 101, 99.5, 100.25, 99.875
Differences: 1.5, -0.75, 0.375
CU = 1.875; CD = 0.75
Laguerre RSI = 100 * 1.875 / 2.625 = 71.4286If the previous stages were all zero and price were 100, the same gamma would instead produce stages 50, -25, 12.5 and -6.25. Its 71.4286 reading would reflect initialization from zero, with no observed price rise required. The optional zero seed in the code sets bar 0 to zero and begins recurrence on bar 1; other scripts may run recurrence on bar 0.
The first-stage difference between two seeds decays by gamma each bar. Later stages inherit earlier-stage differences as well, so a first-stage decay estimate is not a complete warmup rule. Load more history and compare closed-bar values. Exclude the start from alerts until results stabilize for the chosen gamma.
Same price sequence, different RSI readings
This synthetic example starts at bar 0 with price 100, rises by 1 per bar to 114 at bar 14, then falls by 1 to 108 at bar 20. Both Laguerre versions seed their stages at 100. Wilder RSI(14) seeds its average gain at 1 and average loss at 0 after the first 14 changes. All columns use the same price input and bars; no startup values are hidden.
| Bar | Price | Gamma 0.2 | Gamma 0.8 | Wilder RSI(14) |
|---|---|---|---|---|
| 14 | 114 | 100.00 | 95.37 | 100.00 |
| 15 | 113 | 88.73 | 95.25 | 92.86 |
| 16 | 112 | 66.17 | 96.47 | 86.22 |
| 17 | 111 | 25.78 | 100.00 | 80.07 |
| 18 | 110 | 0.00 | 100.00 | 74.35 |
| 19 | 109 | 0.00 | 100.00 | 69.04 |
| 20 | 108 | 0.00 | 100.00 | 64.10 |
After the first down bar, Wilder RSI is 100 × (13/14) = 92.8571. Gamma 0.2 falls below 80 at bar 16, while gamma 0.8 reaches 100 at bar 17 despite falling prices. The slower stage ordering still reflects earlier movement. This is a startup-and-reversal example, not evidence that either gamma predicts the next bar.
For a chart comparison, keep symbol, source, session, timeframe and available history identical. Compare values and level-crossing times in TradingView's Data Window. Gamma has no universal conversion to an RSI length. See the RSI settings guide for the separate Wilder RSI task.
80/20 levels describe events, not orders
On a 0-to-100 scale, 20 and 80 are example reference levels. A script plotting 0 to 1 needs 0.2 and 0.8 instead. No threshold makes a trade profitable by itself.
- Above 80 is a state. Crossing below 80 is an event: previous value at least 80, current value below 80. Staying at 100 produces no new downward crossing.
- Below 20 is a state. Crossing above 20 requires a previous value at or below 20 and a current value above 20.
- Repeated crossings in a range can cause repeated losses after costs. During a sustained move, an extreme can persist while price continues in the same direction.
- Define entries, exits, sizing, fees and slippage separately before testing a strategy. The indicator below creates no orders.
Pine Script v6: stages, comparison and alerts
Paste this complete indicator into TradingView's Pine Editor, save it and add it to a standard candlestick chart. Inputs expose gamma, source, seed policy, alert warmup and thresholds. The orange line is Wilder RSI on the same source.
//@version=6
indicator("Laguerre RSI: gamma and confirmed levels", overlay = false)
source = input.source(close, "Source")
gamma = input.float(0.8, "Gamma", minval = 0.0, maxval = 0.99, step = 0.01)
zeroSeed = input.bool(false, "Initialize stages at zero")
warmupBars = input.int(100, "Initial bars excluded from alerts", minval = 0)
rsiLength = input.int(14, "Wilder RSI comparison length", minval = 1)
lower = input.float(20, "Lower level", minval = 0, maxval = 49)
upper = input.float(80, "Upper level", minval = 51, maxval = 100)
var float l0 = na
var float l1 = na
var float l2 = na
var float l3 = na
if barstate.isfirst
seed = zeroSeed ? 0.0 : source
l0 := seed
l1 := seed
l2 := seed
l3 := seed
else
l0 := (1 - gamma) * source + gamma * l0[1]
l1 := -gamma * l0 + l0[1] + gamma * l1[1]
l2 := -gamma * l1 + l1[1] + gamma * l2[1]
l3 := -gamma * l2 + l2[1] + gamma * l3[1]
cu = math.max(l0 - l1, 0) + math.max(l1 - l2, 0) + math.max(l2 - l3, 0)
cd = math.max(l1 - l0, 0) + math.max(l2 - l1, 0) + math.max(l3 - l2, 0)
lrsi = cu + cd > 0 ? 100 * cu / (cu + cd) : na
baseline = ta.rsi(source, rsiLength)
plot(lrsi, "Laguerre RSI", color = color.blue, linewidth = 2, style = plot.style_linebr)
plot(baseline, "Wilder RSI", color = color.orange)
hline(lower, "Lower level", color = color.gray)
hline(upper, "Upper level", color = color.gray)
hline(50, "Midpoint", color = color.new(color.gray, 60))
crossUp = ta.crossover(lrsi, lower)
crossDown = ta.crossunder(lrsi, upper)
ready = bar_index >= warmupBars and not na(lrsi[1])
confirmedUp = ready and barstate.isconfirmed and crossUp
confirmedDown = ready and barstate.isconfirmed and crossDown
plotshape(confirmedUp, "Closed-bar rise above lower level", shape.triangleup, location.bottom, color.blue, size = size.tiny)
plotshape(confirmedDown, "Closed-bar fall below upper level", shape.triangledown, location.top, color.orange, size = size.tiny)
alertcondition(confirmedUp, "Laguerre RSI above lower level", "Laguerre RSI crossed above its lower level on a closed bar.")
alertcondition(confirmedDown, "Laguerre RSI below upper level", "Laguerre RSI crossed below its upper level on a closed bar.")The first 100 bars are excluded from alert eligibility by default, but remain plotted for inspection. This is an adjustable guard, not a guarantee of convergence. Gamma near 1 may require much more history. The code plots no value when CU + CD is zero and waits for a defined previous reading before an alert can qualify.
Markers and alert conditions require barstate.isconfirmed. The live line still updates before close. Create the desired alert in TradingView after adding the script; the code does not create an active alert automatically. TradingView documents confirmation on the closing update.
Laguerre RSI questions
Sources and limits
Formula and platform documentation checked October 17, 2026. Numerical examples are calculations from the stated inputs, not market observations.
- MotiveWave: Laguerre RSI calculation and initialization
- Sierra Chart: four Laguerre filter recurrences
- TradingView: Wilder RSI calculation and default length
- TradingView Pine Script: bar confirmation
This page is for education and code inspection, not investment advice. Syntax validation cannot establish profitable rules or correct execution assumptions. Compare the final script on your chart and evaluate complete strategies with costs and a separate test period.
Turn the chosen rule into an editable script
Pineify's Pine Script AI Coding Agent can help generate and revise the filter and threshold logic. Specify gamma, source, seed policy, missing-value handling and closed-bar alert rules in the request. Ask it to check syntax, then inspect values in TradingView. The agent does not establish which setting will earn a return.
Open Pine Script AI Coding Agent