OPEN-SOURCE SCRIPT
BitLogic - Kalman Composite

BitLogic Kalman Composite (BL-KC)
What it is
A momentum/condition oscillator that filters price with a multi-stage Kalman and blends two normalized branches into one composite line with a compact score histogram. Built for cleaner flips and fewer whipsaws.
How it works
Inputs you’ll care about
Reading it
Tips
Credits
Inspired by the community idea behind the Kalman Synergy Oscillator (Kalman + RSI + %R). This is an independent, from-scratch implementation with a residual z-score branch and gain-weighted blending for distinct behavior.
Disclaimer
For educational purposes only. Not financial advice. Past performance does not guarantee future results.
What it is
A momentum/condition oscillator that filters price with a multi-stage Kalman and blends two normalized branches into one composite line with a compact score histogram. Built for cleaner flips and fewer whipsaws.
How it works
- Kalman filter (5-stage) on your chosen price source; selectable output (Stage1/Stage5/Average).
- Branch A: RSI on Kalman price → normalized to ~[−0.5, +0.5].
- Branch B (selectable):
- Residual Z: z-score of the Kalman residual (observation − predicted state), squashed for
stability (distinct vs classic KSO)
- Williams %R on Kalman price (normalized). - Gain-weighted blend: the composite weights Branch B by the average Kalman gain (when the filter trusts new info more, residual matters more).
- Zero-line hysteresis: small band around 0 to reduce flip noise.
- Score (columns): quadrant logic → 1, 0.5, −0.5, −1 for quick read of bias + slope.
- No repainting: updates/alerts on bar close.
Inputs you’ll care about
- Q/R (process/measurement noise): responsiveness vs smoothness.
- Blend: base weight + gain weighting.
- Residual Z: lookback & squash scale (controls sensitivity).
- Hysteresis band and optional EMA smoothing of the composite.
Reading it
- Line (ci): above 0 → bullish zone; below 0 → bearish zone.
- Columns (KC_score): show strength/weakness inside each zone (green ≥ 0, orange < 0).
- Alerts: bullish/bearish flip fire on close when the composite crosses the band edges.
Tips
- For faster markets: raise Q, lower smoothing, keep a small hysteresis (e.g., 0.03–0.05).
- For trend following: use Stage5/Average Kalman output and a slightly wider band (0.06–0.10).
- Want “classic” feel? Switch Branch B to Williams %R.
Credits
Inspired by the community idea behind the Kalman Synergy Oscillator (Kalman + RSI + %R). This is an independent, from-scratch implementation with a residual z-score branch and gain-weighted blending for distinct behavior.
Disclaimer
For educational purposes only. Not financial advice. Past performance does not guarantee future results.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.