alexgrover

Falling-Rising Filter

alexgrover Wizard Zaktualizowano   
Introduction

This is a modification of an old indicator i made. This filter aim to adapt to market trend by creating a smoothing constant using highest and lowest functions. This filter is visually similar to the edge-preserving filter, this similarity can make this filter quite good for MA cross strategies.

On The Filter Code

a = nz(a) + alpha*nz(error) + beta*nz(error)

The first 3 terms describe a simple exponential filter where error = price - a, beta introduce the adaptive part. beta is equal to 1 when the price is greater or lower than any past price over length period, else beta is equal to alpha, someone could ask why we use two smoothing variable (alpha, beta) instead of only beta thus having :

a = nz(a) + beta*nz(error)

well alpha make the filter converge faster to the price thus having a better estimation.


In blue the filter using only beta and in red the filter using alpha and beta with both length = 200, the red filter converge faster to the price, if you need smoother results but less precise estimation only use beta.

Conclusion

I have presented a simple indicator using rising/falling functions to calculate an adaptive filter, this also show that when you create an exponential filter you can use more terms instead of only a = a + alpha*(price - a). I hope you find this indicator useful.

Thanks for reading !
Informacje o Wersji:
Fixed a redundant error, thanks to @aaahopper for pointing it out.

Check out the indicators we are making at luxalgo: www.tradingview.com/u/LuxAlgo/
Skrypt open-source

Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz użyć tego skryptu na wykresie?