Forex Zone - Forex Forum

Kalman Filter

Discussion started on TradingView - Pine Script Indicators

Administrator
  • Hero Member
  • Posts: 5235
  • Points: 29698
  • Likes Received: 5234
  • Reputation: +220/-14
Overview:
This indicator applies a Kalman Filter to smooth the selected price series (default is the close) and help reveal the underlying trend by filtering out market noise. The filter is based on a recursive algorithm consisting of two main steps:

  • Prediction Step: The filter predicts the next state using the last estimated value and increases the uncertainty (error covariance) by adding the process noise variance (Q). This step assumes that the price follows a random walk, where the last known estimate is the best guess for the next value.
  • Update Step: The filter computes the Kalman Gain, which determines the weight given to the new measurement (price) versus the prediction. It then updates the state estimate by combining the prediction with the measurement error (using the measurement noise variance, R). The error covariance is also updated accordingly.


Example:
Kalman Filter in TradingView - Pine Script Indicators_topic=4600


User Inputs:
  • Source: Choose any price series (default is the closing price) for filtering.
  • Measurement Noise Variance (R): Controls the sensitivity to new measurements (default is 0.1). A higher R makes the filter less responsive.
  • Process Noise Variance (Q): Controls the assumed level of inherent price variability (default is 0.01). A higher Q allows the filter to adapt more quickly to changes.


Availability:


Linkback: https://www.forex.zone/tradingview-pine-script-indicators/41/kalman-filter/4600/
#1 - February 05, 2025, 01:00:18 AM
Attachments:
Kalman Filter in TradingView - Pine Script Indicators_Forex%20Zone%20VIP%20Membership

Members:

0 Members and 1 Guest are viewing this topic.