The Laguerre Filter is a practical indicator that helps traders identify trends with less noise than a regular moving average.

Understanding the Laguerre Filter
Developed by John F. Ehlers, the Laguerre Filter is a smoothing indicator that reduces market noise while staying responsive to price changes. It filters out the market’s static so you can see the underlying trend more clearly.
What sets the Laguerre Filter apart is its use of Laguerre polynomials to get smoother output without the typical lag associated with traditional moving averages. The indicator consists of two components: the filter itself (which can be overlaid on price charts) and the Laguerre Oscillator, which provides additional insight into market momentum.
// TASC Issue: July 2025
// Article: A Tool For Trend Trading - Laguerre Filters
// Article By: John F. Ehlers
// Language: Amibroker AFL
_SECTION_BEGIN("Laguerre Filters");
// Enable X-Axis with Dates as per Rule No 2
SetChartOptions(0, chartShowArrows | chartShowDates);
// Input Parameters
sourceInput = ParamField("Source", 3); // Close price
usInput = Param("Period", 30, 3, 100, 1); // Critical period of UltimateSmoother
gammaInput = Param("Gamma", 0.5, 0.0, 0.999, 0.01); // Gamma value for Laguerre calculations
rmsInput = Param("RMS Length", 100, 1, 500, 1); // Number of bars in RMS calculation
// Function: UltimateSmoother
// Since AFL doesn't support user-defined functions with multiple return values,
// we'll implement this inline
function UltimateSmoother(srcArray, period)
{
local a1, c2, c3, c1;
local us, i;
a1 = exp(-1.414 * 3.14159 / period);
c2 = 2.0 * a1 * cos(1.414 * 3.14159 / period);
c3 = -a1 * a1;
c1 = (1.0 + c2 - c3) / 4.0;
us = srcArray;
for(i = 4; i < BarCount; i++)
{
us[i] = (1.0 - c1) * srcArray[i] +
(2.0 * c1 - c2) * srcArray[i-1] -
(c1 + c3) * srcArray[i-2] +
c2 * us[i-1] + c3 * us[i-2];
}
return us;
}
// Calculate UltimateSmoother
us = UltimateSmoother(sourceInput, usInput);
// Laguerre Filter implementation
// Using arrays and loops since AFL doesn't support self-referencing
l0 = us;
l1 = sourceInput; // Initialize with source
l2 = sourceInput;
l3 = sourceInput;
l4 = sourceInput;
l5 = sourceInput;
g1 = 1.0 - gammaInput;
// Calculate Laguerre filter components using for loop
for(i = 1; i < BarCount; i++)
{
l1[i] = g1 * l0[i-1] + gammaInput * l1[i-1];
l2[i] = g1 * l1[i-1] + gammaInput * l2[i-1];
l3[i] = g1 * l2[i-1] + gammaInput * l3[i-1];
l4[i] = g1 * l3[i-1] + gammaInput * l4[i-1];
l5[i] = g1 * l4[i-1] + gammaInput * l5[i-1];
}
// Calculate Laguerre Filter
laguerreFilter = (l0 + 4.0 * l1 + 6.0 * l2 + 4.0 * l3 + l5) / 16;
// Laguerre Oscillator implementation
l0_osc = us;
l1_osc = sourceInput; // Initialize
// Calculate l1 for oscillator using for loop
for(i = 1; i < BarCount; i++)
{
l1_osc[i] = l0_osc[i-1] + gammaInput * (l1_osc[i-1] - l0_osc[i]);
}
// Calculate difference
diff = l0_osc - l1_osc;
// Calculate RMS (Root Mean Square)
squaredDiff = diff * diff;
rms = sqrt(MA(squaredDiff, rmsInput));
// Calculate Laguerre Oscillator with zero division protection
laguerreOscillator = IIf(rms != 0, diff / rms, 0);
// Plot Laguerre Filter on main chart
//Plot(laguerreFilter, "Laguerre Filter", colorBlue, styleLine | styleThick);
_SECTION_END();
// Separate section for Laguerre Oscillator (non-overlay indicator)
_SECTION_BEGIN("Laguerre Oscillator");
// Plot Laguerre Oscillator in separate pane
Plot(laguerreOscillator, "Laguerre Oscillator", colorRed, styleLine | styleThick | styleOwnScale);
Plot(0, "Zero Line", colorGrey40, styleLine);
// Fill area between oscillator and zero line
PlotOHLC(0, 0, laguerreOscillator, laguerreOscillator, "",
IIf(laguerreOscillator > 0, colorLightBlue, colorLightOrange),
styleCloud | styleOwnScale);
_SECTION_END();
The Gamma Parameter
The key setting in the Laguerre Filter is the gamma parameter. This single value, ranging from 0 to 0.999, controls the indicator’s behavior:
- Lower gamma values (0.1-0.3): The filter becomes more responsive to price changes, catching trends early but potentially generating more false signals
- Medium gamma values (0.4-0.6): A balanced approach suitable for most trading scenarios
- Higher gamma values (0.7-0.9): The filter becomes smoother, filtering out more noise but potentially missing early trend changes
Reading the Laguerre Oscillator
On the Nifty daily chart above, the Laguerre Oscillator is shown in the lower panel. The oscillator fluctuates between positive (blue) and negative (orange) territories, with the zero line serving as the equilibrium point.
Key Trading Signals:
- Trend Identification: When the oscillator is above zero and rising, it suggests bullish momentum. Conversely, readings below zero indicate bearish pressure.
- Momentum Shifts: The peaks and troughs in the oscillator often precede actual price reversals. Notice how the oscillator topped out in early April before the Nifty began its correction.
- Divergences: One of the more useful signals occurs when price makes a new high/low but the oscillator fails to confirm. This divergence often signals an impending reversal.
Practical Trading Strategies
Strategy 1: Trend Following
The simplest approach is to trade in the direction of the Laguerre Oscillator:
- Enter long when the oscillator crosses above zero
- Exit or go short when it crosses below zero
- Use a slightly higher gamma (0.6-0.7) to filter out whipsaws
Strategy 2: Momentum Extremes
More aggressive traders can look for extreme readings:
- When the oscillator reaches unusually high levels (above 0.8), consider taking profits on long positions
- When it drops to extreme lows (below -0.8), look for potential bounce opportunities
Strategy 3: Divergence Trading
This requires more patience but can yield excellent results:
- Watch for price making new highs while the oscillator makes lower highs (bearish divergence)
- Look for price making new lows while the oscillator makes higher lows (bullish divergence)
Risk Management Considerations
Like any technical indicator, the Laguerre Filter isn’t infallible. Here’s how to use it responsibly:
- Confirm with Price Action: Don’t rely solely on the oscillator. Confirm signals with support/resistance levels, candlestick patterns, or volume.
- Adjust for Market Conditions: In trending markets, use a higher gamma to stay with the trend longer. In choppy markets, lower the gamma for quicker signals.
- Set Clear Stop Losses: Use the oscillator to identify entry points, but always define your risk with predetermined stop losses.
Real-World Application
Looking at the Nifty chart from September 2024 to July 2025, we can see how the Laguerre Oscillator captured several significant moves:
- The October 2024 selloff was preceded by the oscillator turning negative
- The strong rally from March to April 2025 coincided with sustained positive readings
- The recent consolidation phase shows the oscillator hovering around zero, suggesting indecision
The Laguerre Filter is a useful tool for trend identification and momentum analysis. No indicator is perfect, so use the Laguerre Filter as part of a complete trading strategy that includes proper risk management and multiple forms of confirmation.
Before trading it live, start with paper trading to get a feel for how it behaves in different market conditions. With practice, you’ll develop an intuitive understanding of when the Laguerre Filter is giving you high-probability signals and when to exercise caution.
Markets will always be challenging, and the Laguerre Filter gives you one more way to read the trend.
Learn by watching: free videos every week
Market Profile, order flow, Python, AI and OpenAlgo tutorials on YouTube.


You commented
// Since AFL doesn’t support user-defined functions with multiple return values …
AmiBroker has an IIR function which simplifies your ultimatesmoother code to
PI = 3.14159265358979;
length = Param( “Length”, 20, 1, 50, 1 );
function UltimateSmoother( src, period )
{
// using: // https://www.traders.com/Documentation/FEEDbk_docs/2024/05/TradersTips.html
a1 = exp( ( -sqrt( 2 ) * PI ) / period );
c2 = 2 * a1 * cos( ( sqrt( 2 ) * PI ) / period );
c3 = -a1 * a1;
c1 = ( 1 + c2 – c3 ) / 4;
// input for IIR
b0 = ( 1 – c1 );
b1 = ( 2 * c1 – c2 );
b2 = -( c1 + c3 );
a1 = c2;
a2 = c3;
us = IIR( src, b0, a1, b1, a2, b2 );
return us;
}
This code is beyond my coding skills but I found this on the web