KalmanFilter
A smoothed price line that trails the close by about three bars at default settings.
The Kalman filter treats each close as a noisy reading of an underlying price level that drifts randomly. On each bar it blends the new close into its running estimate. The blend weight comes from the ratio of process_noise to measurement_noise: a larger ratio makes the filter trust new closes more. At defaults the weight settles near 0.27, so the output is a lightly smoothed close that sits just behind price.
How to read it
- The line sits on the candles, in the same dollars, not in its own pane.
- It hugs the close and turns a few bars after price turns, because each bar moves it only part of the way to the new close.
- At defaults it adds little beyond the candles; use a preset to make it smoother or tighter.
What it outputs
- Filtered price
- The filtered price level after blending in the newest close, in the same dollars as the candles.
Settings
- process_noise
- How far the filter lets the underlying price drift per bar. Higher follows the candles closer and reacts faster; lower smooths and lags more. At 0 the line stops tracking price and flattens into an average of all bars so far.
- measurement_noise
- How noisy the filter assumes each close is. Higher smooths the line and makes it lag more; lower lets it hug the candles. At 0 the line is the close itself.
Pitfalls
- At default settings the line is nearly the close: correlation 0.999 with the close on SPY one-minute bars, so it adds little information beyond the candles.
- Negative values sit inside the slider range, but both settings are noise variances. A negative value can push the gain outside 0 to 1 or divide by zero; keep both at zero or above.
- Process noise of 0 is not a neutral setting: the gain keeps shrinking bar by bar, so the line stops following price and becomes an average of all bars since the filter started.