OPEN-SOURCE SCRIPT
Gaussian Trend Filter | Lyro RS

█ Overview
Gaussian Blur Trend Filter | Lyro RS is a trend-following overlay that runs price through a two-pass Gaussian blur to build a smoothed baseline, then classifies the market as bullish, bearish, or neutral from the slope of that baseline combined with price's position relative to it.
Where a single moving average reacts to every wiggle in price, this indicator convolves the same Gaussian kernel over price twice. The second pass smooths the already-smoothed series, producing a wider effective kernel with cleaner slope behaviour than a single-pass filter of the same length — fewer false slope changes, later noise-driven flips.

The result is a coloured baseline with a filled cloud back to price, flip labels marking the exact bar of a trend change, and recoloured candles so the whole chart reflects the current state at a glance.
█ How It Works
█ How to Use
Gaussian Blur Trend Filter | Lyro RS is a trend-following overlay that runs price through a two-pass Gaussian blur to build a smoothed baseline, then classifies the market as bullish, bearish, or neutral from the slope of that baseline combined with price's position relative to it.
Where a single moving average reacts to every wiggle in price, this indicator convolves the same Gaussian kernel over price twice. The second pass smooths the already-smoothed series, producing a wider effective kernel with cleaner slope behaviour than a single-pass filter of the same length — fewer false slope changes, later noise-driven flips.
The result is a coloured baseline with a filled cloud back to price, flip labels marking the exact bar of a trend change, and recoloured candles so the whole chart reflects the current state at a glance.
█ How It Works
⚪ Gaussian Weighting
Each bar in the lookback window is weighted using a Gaussian curve rather than a flat or linear taper, so nearby bars dominate but older bars still contribute smoothly instead of dropping out abruptly.Pine Script®
sigma is set as a percentage of Kernel Length via the Blur Width input, which shapes how quickly that weighting falls off.
⚪ Two-Pass Convolution
The first pass smooths raw close into an intermediate series. The second pass smooths that already-blurred series with the same kernel. Two convolved Gaussians combine into one wider, cleaner Gaussian — this is what removes the "noise of the noise" that a single pass leaves behind.
⚪ Trend Classification
The trend only flips to bullish when the baseline is rising and price closes above it, and only flips to bearish when the baseline is falling and price closes below it. Outside of those conditions the previous state is held, so the trend is sticky rather than flickering on ambiguous bars.
⚪ Visual Layer
The baseline is drawn as a stacked outer-glow / glow / core-line plot for a soft neon look, the raw first-pass line is kept visible but faint as a reference, the space between baseline and price is filled as a trend cloud, and candles are recoloured to match the active trend.
█ How to Use
⚪ Reading the Cloud
Cloud colour and fill direction show the current bias and how far price has stretched from the smoothed baseline.
⚪ Flip Labels
"Long" and "Short" labels mark the exact bar where trend state changed — useful as an entry trigger or as confirmation of a bias shift.
⚪ Tuning Kernel Length
Shorter length reacts faster and produces more flips; longer length is smoother but lags further behind price. Lower timeframes generally want shorter settings.
⚪ Tuning Blur Width
Controls how sharply the Gaussian weighting falls off relative to Kernel Length. Lower values keep more first-pass detail; higher values flatten the weighting curve for extra smoothness.
⚪ Alerts
Two built-in alert conditions — Bullish Flip and Bearish Flip — let you get notified the moment the trend state changes without watching the chart.
█ Settings
- Kernel Length (5–100, default 30) — number of bars used in the Gaussian window for both blur passes.
- Blur Width (0.1–1.0, step 0.05, default 0.35) — Gaussian sigma as a fraction of Kernel Length.
- Custom Color Palette — Classic, Mystic (default), Accented, or Royal preset schemes.
- Use Custom Palette — overrides the preset with your own Up/Down colours.
█ Important
The double Gaussian pass trades reactivity for a cleaner slope — the baseline will lag raw price more than a single-pass filter of the same length. Reduce Kernel Length on faster markets or lower timeframes if that lag feels excessive. Trend state is confirmed on bar close and does not repaint historically, though the state of the currently forming bar can still change until it closes.
This script is provided for educational and informational purposes only and does not constitute financial advice. Past performance of any strategy, indicator, or trading approach does not guarantee future results.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Get access to our private indicators: whop.com/lyro-rs
Join our community: discord.gg/kcEBMWaFjS
Join our community: discord.gg/kcEBMWaFjS
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Get access to our private indicators: whop.com/lyro-rs
Join our community: discord.gg/kcEBMWaFjS
Join our community: discord.gg/kcEBMWaFjS
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.