TradingView
chrism665
19. Aug. 2020 17:29

Band-Pass Filter 

S&P 500 index of US listed sharesFXCM

Beschreibung

Just a clean script that can be applied on top of other indicators/sources or you can take the function out of the source and use it in other scripts.

The idea for this was taken from https://www.pinecoders.com/techniques/dsp/#fir-band-pass-filters-design except I am utilizing an EMA instead of SMA. Simply put, we are combining a low-pass filter (moving average) with a high-pass filter (smoothed difference between the source and moving average). The result is a filter/moving average that provides a great combination of minimizing noise while still reacting strongly to price and trend changes.

I like to use this filter in place of other MAs in Pine Scripts to smooth my data. So instead of doing something like sma(stochastic,5) I can easily plug in bp(stochastic,5). It works just fine for your primary moving averages against price as well.
Kommentare
sal157011
This the same as a dema():
dema(src,len)=>
2*ema(src,len)-ema(ema(src,len),len)
chrism665
@sal157011, I know of DEMA and TEMA and have seen that formula before, but never put it together that it gives the exact same result. Thanks! :)
Mehr