indicator · on price · open source
Modular Filter
Running…
Loading chart…
About
Modular Filter is the simplest single-pole low-pass smoother: each bar is the previous output plus half the change from price. Cute for showing how a moving-average kernel works — and surprisingly useful on highly smoothed inputs.
- Cutoff is fixed; treat it as a learning toy or sanity baseline.
- Great for visualizing the gap-filler problem an EMA solves.
- Not recommended for production signals.
Source code
//@version=5
indicator("Modular Filter", overlay=true)
src = input.source("close", "Source")
k = input.float(0.5, "Blend rate", minval=0.01, maxval=1, step=0.05)
var float mf = 0.0
mf := nz(mf[1], src) + (src - nz(mf[1], src)) * k
p_Modular = plot(mf, "Modular", color=color.gray, linewidth=2)
alertcondition(ta.crossover(close, mf), "Price crosses above Modular", "Price crossed above the modular filter")
alertcondition(ta.crossunder(close, mf), "Price crosses below Modular", "Price crossed below the modular filter")
No comments yet.
Sign in to comment.