Adaptive Kalman filter - Trend Strength Oscillator (Zeiierman)█ Overview
The Adaptive Kalman Filter - Trend Strength Oscillator by Zeiierman is a sophisticated trend-following indicator that uses advanced mathematical techniques, including vector and matrix operations, to decompose price movements into trend and oscillatory components. Unlike standard indicators, this model assumes that price is driven by two latent (unobservable) factors: a long-term trend and localized oscillations around that trend. Through a dynamic "predict and update" process, the Kalman Filter leverages vectors to adaptively separate these components, extracting a clearer view of market direction and strength.
█ How It Works
This indicator operates on a trend + local change Kalman Filter model. It assumes that price movements consist of two underlying components: a core trend and an oscillatory term, representing smaller price fluctuations around that trend. The Kalman Filter adaptively separates these components by observing the price series over time and performing real-time updates as new data arrives.
Predict and Update Procedure: The Kalman Filter uses an adaptive predict-update cycle to estimate both components. This cycle allows the filter to adjust dynamically as the market evolves, providing a smooth yet responsive signal. The trend component extracted from this process is plotted directly, giving a clear view of the prevailing direction. The oscillatory component indicates the tendency or strength of the trend, reflected in the green/red coloration of the oscillator line.
Trend Strength Calculation: Trend strength is calculated by comparing the current oscillatory value against a configurable number of past values.
█ Three Kalman filter Models
This indicator offers three distinct Kalman filter models, each designed to handle different market conditions:
Standard Model: This is a conventional Kalman Filter, balancing responsiveness and smoothness. It works well across general market conditions.
Volume-Adjusted Model: In this model, the filter’s measurement noise automatically adjusts based on trading volume. Higher volumes indicate more informative price movements, which the filter treats with higher confidence. Conversely, low-volume movements are treated as less informative, adding robustness during low-activity periods.
Parkinson-Adjusted Model: This model adjusts measurement noise based on price volatility. It uses the price range (high-low) to determine the filter’s sensitivity, making it ideal for handling markets with frequent gaps or spikes. The model responds with higher confidence in low-volatility periods and adapts to high-volatility scenarios by treating them with more caution.
█ How to Use
Trend Detection: The oscillator oscillates around zero, with positive values indicating a bullish trend and negative values indicating a bearish trend. The further the oscillator moves from zero, the stronger the trend. The Kalman filter trend line on the chart can be used in conjunction with the oscillator to determine the market's trend direction.
Trend Reversals: The blue areas in the oscillator suggest potential trend reversals, helping traders identify emerging market shifts. These areas can also indicate a potential pullback within the prevailing trend.
Overbought/Oversold: The thresholds, such as 70 and -70, help identify extreme conditions. When the oscillator reaches these levels, it suggests that the trend may be overextended, possibly signaling an upcoming reversal.
█ Settings
Process Noise 1: Controls the primary level of uncertainty in the Kalman filter model. Higher values make the filter more responsive to recent price changes, but may also increase susceptibility to random noise.
Process Noise 2: This secondary noise setting works with Process Noise 1 to adjust the model's adaptability. Together, these settings manage the uncertainty in the filter's internal model, allowing for finely-tuned adjustments to smoothness versus responsiveness.
Measurement Noise: Sets the uncertainty in the observed price data. Increasing this value makes the filter rely more on historical data, resulting in smoother but less reactive filtering. Lower values make the filter more responsive but potentially more prone to noise.
O sc Smoothness: Controls the level of smoothing applied to the trend strength oscillator. Higher values result in a smoother oscillator, which may cause slight delays in response. Lower values make the oscillator more reactive to trend changes, useful for capturing quick reversals or volatility within the trend.
Kalman Filter Model: Choose between Standard, Volume-Adjusted, and Parkinson-Adjusted models. Each model adapts the Kalman filter for specific conditions, whether balancing general market data, adjusting based on volume, or refining based on volatility.
Trend Lookback: Defines how far back to look when calculating the trend strength, which impacts the indicator's sensitivity to changes in trend strength. Shorter values make the oscillator more reactive to recent trends, while longer values provide a smoother reading.
Strength Smoothness: Adjusts the level of smoothing applied to the trend strength oscillator. Higher values create a more gradual response, while lower values make the oscillator more sensitive to recent changes.
-----------------
Disclaimer
The information contained in my Scripts/Indicators/Ideas/Algos/Systems does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
My Scripts/Indicators/Ideas/Algos/Systems are only for educational purposes!