Kalman Smoother Pass Node

Kalman Filter Adaptive Smoothing — Series Input

AdvancedSignal ProcessingPass

Overview

The Kalman Smoother Pass Node applies a 1D Kalman filter to a series input, producing an optimally smoothed output under the assumption of Gaussian process and observation noise. It adaptively removes noise while preserving trend dynamics — responding faster to large moves and slower during consolidation.

Unlike a simple moving average, the Kalman filter's smoothing is state-dependent: it continuously estimates the signal's true value by balancing predicted state uncertainty (processNoise) against observation uncertainty (obsNoise). The ratio processNoise/obsNoise controls the responsiveness vs. smoothness trade-off.

Algorithm

Initialize: estimate = series[0], errorCovariance = 1
For each bar i:
// Predict
predictedEstimate = estimate
predictedError = errorCovariance + processNoise
// Update
kalmanGain = predictedError / (predictedError + obsNoise)
estimate = predictedEstimate + kalmanGain × (series[i] − predictedEstimate)
errorCovariance = (1 − kalmanGain) × predictedError
Output[i] = estimate
Output: Kalman-smoothed values aligned to input. Recursive from bar 0; no fixed warm-up.

Parameters

ParameterDefaultDescription
processNoise0.01Process noise variance Q — how much the true state can change per bar
obsNoise1.0Observation noise variance R — how noisy the observed values are assumed to be

Inputs & Outputs

SlotDirectionTypeDescription
inputInput{ values, timestamps }Any numeric series to filter
valuesOutput(number | null)[]Kalman-smoothed values aligned to input
timestampsOutputnumber[]Unix timestamps aligned to input

Use Cases

Low-Lag Trend Smoothing

Use Kalman Smoother Pass as a drop-in replacement for a moving average — it tracks the trend with less lag than an EMA of equivalent responsiveness, because it adaptively weights recent observations more heavily during rapid price changes.

Signal Pre-Processing

Apply Kalman smoothing before feeding a noisy indicator (e.g., RSI, raw volume) into a threshold-based or crossover strategy. The filter removes high-frequency noise while preserving the directional structure needed for reliable signal generation.

Velocity Estimation

The first difference of the Kalman-smoothed series provides a noise-reduced velocity (rate of change) estimate. This is far more stable than raw returns or ROC on noisy series — useful for momentum-based strategies that use the rate of indicator change as the signal.

Tips & Best Practices

processNoise/obsNoise Ratio Controls Smoothing

What matters is the ratio Q/R (processNoise/obsNoise). High Q/R (e.g., 0.1/1.0) means the filter trusts observations more — faster response, less smoothing. Low Q/R (e.g., 0.001/1.0) means the filter trusts the model more — slower response, more smoothing.

Stable From Bar 1

Unlike windowed indicators, the Kalman filter produces a valid output from bar 0. The filter converges quickly — by bar 5–10 the Kalman gain has typically stabilized. You can safely use the full output without discarding early bars.

Not a Predictive Filter

The 1D Kalman Smoother (constant velocity model) only smooths — it does not predict future values. For predictive extrapolation, a 2-state Kalman filter (position + velocity) is needed. This node is best used for noise removal, not forecasting.

Related Indicators