TradingView
cheatcountry
18 giu 2020 22:15

Ehlers Truncated BandPass Filter [CC] 

Apple Inc.NASDAQ

Descrizione

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!

Note di rilascio

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!

Note di rilascio

Ignore the previous release notes. Now that tv uses arrays I have fixed the indicator to work as originally intended
Commenti
junkie190690
Thank you!
cheatcountry
greyghost7
how is it better than original?
cheatcountry
@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
harkalada31
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, This was done on purpose because there is a technical issue with tv that prevents me from showing the correct code
harkalada31
@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).
sal157011
Comparing your code with the traders' tips codes isn't the loop part missing ?
cheatcountry
@sal157011, he uses the loop to populate an array which isn't needed with pinescript
Altro