cheatcountry

Ehlers Truncated BandPass Filter [CC]

Hot off the presses! The Truncated BandPass Filter was created by John Ehlers (Stocks & Commodities July 2020) and this is a much more reactive version of his original bandpass filter. When the indicator rises above 0 then it is an uptrend and when it falls below 0 then it is in a downtrend. Buy when the indicator line is red and sell when it is green.

Let me know if there are other scripts you would like to see me publish or if you want something custom done!
릴리즈 노트: The FM Demodulator Indicator was created by John Ehlers (Stocks and Commodities May 2021 pg 14) and this is a very good complementary indicator to the new AM Detector that I just published. It uses his super smoother filter for smoothing but you can try other combos for smoothing. This indicator does a very good job tracking price swings as you can see it follows the major swings pretty well. Buy when the line turns green and sell when it turns red.

Let me know if there are any other indicators you would like to see me publish!
릴리즈 노트: Ignore the previous release notes. Now that tv uses arrays I have fixed the indicator to work as originally intended
오픈 소스 스크립트

진정한 TradingView의 정신에 따라, 이 스크립트의 작성자는 스크립트를 오픈소스로 게시했기에 거래자들이 이해하고 확인할 수 있습니다. 작가님께 건배! 스크립트를 무료로 사용할 수 있지만, 게시물에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 당신은 스크립트를 차트에 사용하기 위해 그것을 즐겨찾기 할 수 있습니다.

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

코멘트

how is it better than original?
응답
cheatcountry greyghost7
@greyghost7, there is a technical error right now with pinescript which isn't allowing me to correct the code. I will update this script as soon as they fix the bug
응답
Here must be ...(1 + s1) * nz(trunc(1))... instead of ...(1 + s1) * nz(trunc(2)).... If you make such correction you get IIR Bandpass Filter not a truncated version.
응답
cheatcountry harkalada31
@harkalada31, This was done on purpose because there is a technical issue with tv that prevents me from showing the correct code
응답
harkalada31 cheatcountry
@cheatcountry, your code is incorrect. The idea of FIR filters, and truncated version of Bandpass Filter is a FIR filter, that you have to use coefficients with every element of the filter. In example with EMA in article this is demonstrated very well. There are only one element of previous values in EMA and that is why you use only one set of coefficients. In bandpass filter there are two such elements BP(1) and BP(2). To get FIR filter from IIR you have to use two set of coefficients. For that purpose Mr Ehlers uses arrays for calculation of truncated version of Bandpass Filter, one for BP(1) and another for BP(2).
응답
Comparing your code with the traders' tips codes isn't the loop part missing ?
응답
cheatcountry sal157011
@sal157011, he uses the loop to populate an array which isn't needed with pinescript
응답