alexgrover

Narrow Bandpass Filter

In technical analysis most bandpass filters like the MACD, TRIX, AO, or COG will have a non-symmetrical frequency response, in fact, this one is generally right-skewed. As such these oscillators will not fully remove lower and higher frequency components from the input signal, the following indicator is a bandpass filter with a more symmetrical frequency response with the possibility to have a narrow bandwidth, this allows the indicator to potentially isolate sinusoids from the input signal.

Indicator & Settings

The filter is calculated via convolution, if we take into account that the frequency response of a filter is the Fourier transform of its weighting function we can deduce that we can get a narrow response by using a sinusoid sin(2𝛑nf) as the weighting function, with the peak of the frequency response being equal to f, this makes the filter quite easy to control by the user, as this one can choose the frequency to be isolated. The length of the weighting function controls the bandwidth of the frequency response, with a higher length returning an ever-smaller frequency response width.

In the indicator settings the "Cycle Period" determine the period of the sinusoid used as a weighting function, while "Bandwidth" determine the filter passband width, with higher values returning a narrower passband, this setting also determine the length of the convolution, because the sum of the weights must add to 0 we know that the length of the convolution must be a multiple of "Cycle Period", so the length of the convolution is equal to "Cycle Period × Bandwidth".

Finally, the windowing option determines if a window is applied to the weighting function, a weighting function allow to remove ripples in the filter frequency response


Above both indicators have a Cycle period of 100 and a Bandwidth of 4, we can see that the indicator with no windowing don't fully remove the trend component in the price, this is due to the presence of ripples allowing lower frequency components to pass, this is not the case for the windowed version.

In theory, an ultra-narrow passband would allow to fully isolate pure sinusoids, below the cycle period of interest is 20


using a bandwidth equal to 10 allow to retain that sinusoid, however, note that this sinusoid is subject to phase shift and that it might not be a dominant frequency in the price.


Check out the indicators we are making at luxalgo: www.tradingview.com/u/LuxAlgo/
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?