KennedyAdaptiveBaseline
- Indicatori
- Ryan Paul Kennedy
- Versione: 1.41
- Aggiornato: 17 settembre 2025
KAB: A Better Baseline.
Retail traders tend to "experiment" with tweaking lookback periods manually, repeatedly, until they curve-fit. Instead of cycling EMA(20), EMA(21), EMA(22), we can use KAB.
Unlike moving averages (SMA, EMA, WMA, etc.) that are static, and more complex ones (Hull, T3) that are parameter driven, KAB is volatility-aware.
The ratio of ATRs (the volatility of volatility) drives the adaptive smoothing gain. Result: stable during chaos, responsive during drift.
Most adaptive indicators (Kaufman’s, VIDYA, etc.) use efficiency ratios (price direction vs. noise) or raw volatility. KAB uses relative volatility (fast vs slow).
KAB behaves similarly to a moving average / baseline, but it's core mechanism is unique.
Mechanism
- Calculate short and long ATR.
- Compute ratio = short / long.
- Scale the smoothing coefficient ( alpha ) by this ratio.
- Cap the maximum gain (optional).
- Optionally lock output when volatility exceeds a threshold.
- Optional second smoothing pass.
This tool is intended for system integration, not for standalone signal generation. It acts as a baseline filter, ideal for:
-
Trend-following bias confirmation
-
Gating during uncertainty
-
Anchoring mean-reversion logic
-
Volatility-informed position sizing
Interpretation
-
When the line is flat: volatility is compressed or the system is in structural chop.
-
When the line is sloped: price is drifting directionally under clean volatility structure.
-
When price diverges persistently from KAB: strong trend conviction is implied.
-
When price oscillates around KAB: environment favors mean reversion.
-
When the line freezes: volatility has exceeded the lock threshold, and the system is in high-risk regime.
External Parameters
- BaseAlpha = base smoothing gain (default: 0.1)
- ShortATRPeriod = fast ATR window (default: 8)
- LongATRPeriod = slow ATR window (default: 64)
- UseTwoStage = enable second smoothing layer (default: true)
- SmoothFactor = gain for 2nd-stage smoothing (default: 0.2)
- MaxAlpha = max allowed adaptive gain (default: 0.2)
- EnableLock = freeze signal if vol too high (default: true)
- LockOnThresh = lock trigger ratio (default: 2.0)
- LockOffThresh = unlock ratio (default: 1.8)
- UnlockBars = bars to force-release lock (default: 50)
Python+PineScript versions available on Github:
-
GitHub: github.com/DieArchitekt
-
ORCID: 0009-0006-3598-0581
Please leave a review.
License
MIT License – free for all use cases with attribution.

Very interesting and excellent made indicator! Thank you very much!