The Kalman filter is a recursive algorithm developed in 1960 by Rudolf E. Kálmán, a Hungarian-American engineer and mathematician, that provides optimal estimates of a system's state by combining noisy measurements with a predictive model. It is widely used in control systems, signal processing, and finance for tracking and forecasting.
In trading, KF might be a good replacement for a moving average, as it reacts to price changes in a different way. Not only it follows price direction, but can also track the velocity of price change. This specific behaviour of KF is used in this indicator to track changes in trends.
Trend is characterized by price moving directionally, however, any trend comes to pause or complete stop and reversal, as the price changes more slowly (a trend fades into a sideways movement for a while) or the price movement changes direction, thus making a reversal.
This indicator detects the points where such changes occur (trend breaker points), and produces signals, which serve as points of current trend pausing or reversing. By applying different settings for KF calculation, you can produce less or more signals that indicate change in trend character, and either detect only significant trends changes, or less and shorter trends changes as well.
The signals do not differentiate the exact type of a trend change (it can be a brief trend pause followed by a continuation, as well as a complete reversal). However, once you are in a trend, the significant velocity change indicates a change in trend structure. In this sense, trend breaker signals should not be followed blindly, and can be used only as trend (and subsequently, position) exit confirmations, but not the entry contrarian confirmations.
For better visual representation, you can use chart signals attached to bars, and additionally paint a vertical gradient at each signal which shows significant trend deceleration.
Kalman filter calculations used in this indicator are partially based on an open-source code from loxx which was published in 2022 as Kalman filter overlay.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publications is governed by House rules. Você pode favoritá-lo para usá-lo em um gráfico.
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.