OPEN-SOURCE SCRIPT

Kalman Regime [Jamallo]

1 629
(2025)

Intro

Kalman Regime filters price through two stages — a Gaussian kernel weighted average followed by an adaptive Kalman filter — to produce a smooth, noise-resistant baseline. ATR is used throughout to make the system volatility-aware.

Breakdown

The Gaussian kernel pre-smooths price using a bell-shaped weight profile that blends recency bias (recent bars matter more) with center localization (edge bars contribute less). This pre-smoothed value is then passed into an adaptive Kalman filter, which recursively estimates the "true" price state by balancing how much to trust the new measurement versus the prior state — with that balance dynamically scaled by current ATR.

The resulting baseline drives regime detection through a two-tier state machine. A strong signal fires when price breaks the ATR envelope and the baseline slope confirms direction. A weaker signal fires when price crosses the baseline and slope exceeds an ATR-scaled threshold. This dual-gate structure reduces whipsaws without adding lag.

END

A two-stage price filter combining a Gaussian kernel pre-smoother with an adaptive Kalman filter, using ATR envelopes and slope confirmation for regime detection.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.