OPEN-SOURCE SCRIPT

FIR Low Pass Filter Suite (FIR)

The FIR Low Pass Filter Suite is an advanced signal processing indicator that applies finite impulse response (FIR) filtering techniques to price data. At its core, the indicator uses windowed-sinc filtering, which provides optimal frequency response characteristics for separating trend from noise in financial data.

The indicator offers multiple window functions including Kaiser, Kaiser-Bessel Derived (KBD), Hann, Hamming, Blackman, Triangular, and Lanczos. Each window type provides different trade-offs between main-lobe width and side-lobe attenuation, allowing users to fine-tune the frequency response characteristics of the filter. The Kaiser and KBD windows provide additional control through an alpha parameter that adjusts the shape of the window function.

A key feature is the ability to operate in either linear or logarithmic space. Logarithmic filtering can be particularly appropriate for financial data due to the multiplicative nature of price movements. The indicator includes an envelope system that can adaptively calculate bands around the filtered price using either arithmetic or geometric deviation, with separate controls for upper and lower bands to account for the asymmetric nature of market movements.

The implementation handles edge effects through proper initialization and offers both centered and forward-only filtering modes. Centered mode provides zero phase distortion but introduces lag, while forward-only mode operates causally with no lag but introduces some phase distortion. All calculations are performed using vectorized operations for efficiency, with carefully designed state management to handle the filter's warm-up period.

Visual feedback is provided through customizable color gradients that can reflect the current trend direction, with optional glow effects and background fills to enhance visibility. The indicator maintains high numerical precision throughout its calculations while providing smooth, artifact-free output suitable for both analysis and visualization.
Bands and ChannelsdspfilterLOGARITHMIClowpassmathematicalMoving AveragesParallel ChannelPine utilities

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?


Ngoài ra, trên:

Thông báo miễn trừ trách nhiệm