TradingView
alexgrover
7 de Ago de 2019 15:47

Hybrid Convolution Filter 

Advanced Micro Devices, Inc.NASDAQ

Descrição

Introduction

Today i propose an hybrid filter that use a classical FIR architecture while using recursion. The proposed method aim to reduce the lag generated by fir filters. This particular filter is a sine weighted moving average, but you can change it since the indicator is built with the custom filter template (1). Even if it use recursion it still is a FIR filter since the impulse response is finite.

The Indicator



In red the hybrid swma and in blue the classic swma of both the same period. The difference can be seen.

The switch between the input price and the past values of the previous convolution values is made by using exponential averaging, the window function is the same as f(x) in the code.

Any filter can use this architecture, the indicator is built around the custom fir template, see (1)

Conclusion

I presented a FIR filter using recursion in its calculation, the integration is made with respect to the proposed template, therefore any user can simply modify f(x) to have different filter without the need to make any change. However curious users might want to change the window function of the exponential averager, in order to do so change sgn = f(i/length) in line 11 for sgn = fun(i/length) where fun is your custom function, make sure to add it at the start of the script where all the other functions declarations are.

Thanks for reading !

(1)

tradingview.com/script/VttW3bJY-Template-For-Custom-FIR-Filters-Make-Your-Moving-Average/
Comentários
YawningTiger
Love this using the 4 with settings 25, 50, 100 and 200 together.
alexgrover
@Candoit2, Glad to hear it, thx for sharing your settings :)
ICEKI
What a great enhanced improvment for the FIR filter; thank you Alex =D
DannyBaker
Great, as usual! i would love to see what you come up with if you incorporate volume, for instance, VWAP is used by institutional investors and volume profile is a great way to see where institutions are accumulating, youtube.com/watch?v=AN1jpwCLOWo
DannyBaker
@hugonicolson, sometimes following the market makers/institutions is the best thing we can do
alexgrover
@hugonicolson, Thanks for the support :)
idrisbengali
classic one Alex - Thanks
alexgrover
@idrisbengali, Thanks, i really wanted to test this one out :)
AltJams
Very cool, I really dig the modularity. Thanks dude!
alexgrover
@wroclai, Glad you like it :) Thanks for always leaving a comment.
Mais