OPEN-SOURCE SCRIPT
Kalman Flow | Lyro RS

The Kalman Flow is an adaptive trend-following tool designed to identify and track market direction by combining a two-state Kalman filter with noise-scaled deviation bands. Unlike traditional moving-average systems, this indicator estimates both the underlying price level and its velocity (drift per bar) simultaneously, requiring agreement between price displacement and directional drift before confirming a trend change.
How It Works
1. Kalman Baseline [Level + Velocity]
This is the core engine of the indicator — a constant-velocity Kalman filter that recursively predicts the next price level from its current level and velocity states, then corrects the prediction using actual price. Because the filter gain depends only on the process-to-measurement noise ratio, behavior is consistent across all assets and price scales.
2. Adaptive Noise Bands
Instead of ATR or standard deviation, the bands are scaled by the filter's own tracking error — the average absolute distance between price and the Kalman estimate.
The two multipliers are independent, allowing asymmetric tuning of bullish and bearish flip thresholds. The bands automatically widen in choppy conditions and tighten in clean trends, so flips require a move that is large relative to recent noise — not a fixed size.
3. Velocity-Confirmed Trend Engine
A trend flip requires both conditions at once:
Anything less holds the current state, creating built-in hysteresis that filters out displacement without follow-through.
Practical Application
Signal Interpretation
Trend Confirmation
The velocity requirement serves as a confirmation layer — a single spike through a band without genuine drift behind it will not flip the trend, reducing the likelihood of false signals during choppy or low-volatility conditions. Built-in alerts cover bullish flips, bearish flips, and any flip.
⚠️ Disclaimer
This indicator is a technical analysis tool and does not guarantee results. It should be used in conjunction with additional analysis methods and proper risk management strategies. The creators of this indicator are not responsible for any financial decisions made based on its signals.
How It Works
1. Kalman Baseline [Level + Velocity]
This is the core engine of the indicator — a constant-velocity Kalman filter that recursively predicts the next price level from its current level and velocity states, then corrects the prediction using actual price. Because the filter gain depends only on the process-to-measurement noise ratio, behavior is consistent across all assets and price scales.
- Higher Sensitivity → the baseline tracks price closely and reacts faster.
- Lower Sensitivity → a smoother baseline with fewer, more selective flips.
2. Adaptive Noise Bands
Instead of ATR or standard deviation, the bands are scaled by the filter's own tracking error — the average absolute distance between price and the Kalman estimate.
- Upper Band = Kalman Baseline + (Tracking Error × + Multiplier)
- Lower Band = Kalman Baseline − (Tracking Error × − Multiplier)
The two multipliers are independent, allowing asymmetric tuning of bullish and bearish flip thresholds. The bands automatically widen in choppy conditions and tighten in clean trends, so flips require a move that is large relative to recent noise — not a fixed size.
3. Velocity-Confirmed Trend Engine
A trend flip requires both conditions at once:
- A close beyond the opposite noise band (displacement).
- Kalman velocity agreeing with the new direction (drift).
Anything less holds the current state, creating built-in hysteresis that filters out displacement without follow-through.
Practical Application
Signal Interpretation
- A Long signal is generated when price closes above the upper band while Kalman velocity is positive.
- A Short signal is generated when price closes below the lower band while Kalman velocity is negative.
- Candle coloring and the baseline color always reflect the current trend state.
Trend Confirmation
The velocity requirement serves as a confirmation layer — a single spike through a band without genuine drift behind it will not flip the trend, reducing the likelihood of false signals during choppy or low-volatility conditions. Built-in alerts cover bullish flips, bearish flips, and any flip.
⚠️ Disclaimer
This indicator is a technical analysis tool and does not guarantee results. It should be used in conjunction with additional analysis methods and proper risk management strategies. The creators of this indicator are not responsible for any financial decisions made based on its signals.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Get access to our private indicators: whop.com/lyro-rs
Join our community: discord.gg/kcEBMWaFjS
Join our community: discord.gg/kcEBMWaFjS
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Get access to our private indicators: whop.com/lyro-rs
Join our community: discord.gg/kcEBMWaFjS
Join our community: discord.gg/kcEBMWaFjS
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.