indicator · on price · open source
Gaussian Filter
Running…
Loading chart…
About
Gaussian Filter is a single-pole Gaussian kernel applied recursively. Beautifully smooth, no overshoot, and the canonical noise-reduction stage that Ehlers builds most of his other filters on.
- Raise
width(the standard-deviation multiplier) for a thicker, smoother line. - Best on noisy assets (BTCUSD, ES) and as a pre-smoother for downstream indicators.
- Combine with a faster line for non-trendline Gaussian crossover signals.
Source code
//@version=5
indicator("Gaussian Filter", overlay=true)
len = input.int(14, "Period", minval=1, maxval=500)
width = input.float(2, "Width (σ multiplier)", minval=0.5, maxval=5, step=0.1)
src = input.source("close", "Source")
w = math.exp(-math.pow(width, 2) / 2.0)
var float g = 0.0
g := w * src + (1.0 - w) * nz(g[1], src)
p_Gaussian = plot(g, "Gaussian", color=color.silver, linewidth=2)
alertcondition(ta.crossover(close, g), "Price crosses above Gaussian", "Price crossed above the Gaussian Filter")
alertcondition(ta.crossunder(close, g), "Price crosses below Gaussian", "Price crossed below the Gaussian Filter")
No comments yet.
Sign in to comment.