⚪State Vector (X): The state vector is a two-dimensional array where each element represents a market property. The first element is an estimate of the true price, while the second element represents the rate of change or trend in that price. This vector is updated iteratively with each new price, maintaining an ongoing estimate of both price and trend direction.
⚪Covariance Matrix (P): The covariance matrix represents the uncertainty in the state vector’s estimates. It continuously adapts to changing conditions, representing how much error we expect in our trend and price estimates. Lower covariance values suggest higher confidence in the estimates, while higher values indicate less certainty, often due to market volatility.
⚪Process Noise (Q): The process noise matrix (Q) is used to account for uncertainties in price movements that aren’t explained by historical trends. By allowing some degree of randomness, it enables the Kalman Filter to remain responsive to new data without overreacting to minor fluctuations. This noise is particularly useful in smoothing out price movements in highly volatile markets.
⚪Measurement Noise (R): Measurement noise is an external input representing the reliability of each new price observation. In this indicator, it is represented by the setting Measurement Noise and determines how much weight is given to each new price point. Higher measurement noise makes the indicator less reactive to recent prices, smoothing the trend further.
⚪Update Equations:
- Prediction: The state vector and covariance matrix are first projected forward using a state transition matrix (F), which includes market estimates based on past data. This gives a “predicted” state before the next actual price is known.
- Kalman Gain Calculation: The Kalman gain is calculated by comparing the predicted state with the actual price, balancing between the covariance matrix and measurement noise. This gain determines how much of the observed price should influence the state vector.
- Correction: The observed price is then compared to the predicted price, and the state vector is updated using this Kalman gain. The updated covariance matrix reflects any adjustment in uncertainty based on the latest data.
قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الرمز في المنشور يخضع لقواعدقوانين الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.