OPEN-SOURCE SCRIPT

Kalman Regime [Jamallo]

985
(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.

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.