alexgrover

Hybrid Convolution Filter

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)

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?
Patreon: https://www.patreon.com/alexgrover

Become a Patreon and get access to exclusive technical indicators!

You can also check out some of the indicators I made for luxalgo : https://www.tradingview.com/u/LuxAlgo/#published-scripts

Comments

Love this using the 4 with settings 25, 50, 100 and 200 together.
+1 Reply
alexgrover Candoit2
@Candoit2, Glad to hear it, thx for sharing your settings :)
Reply
What a great enhanced improvment for the FIR filter; thank you Alex =D
+1 Reply
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, https://www.youtube.com/watch?v=AN1jpwCLOWo
+1 Reply
DannyBaker DannyBaker
@DannyBaker, sometimes following the market makers/institutions is the best thing we can do
+1 Reply
alexgrover DannyBaker
@DannyBaker, Thanks for the support :)
Reply
classic one Alex - Thanks
+1 Reply
alexgrover idrisbengali
@idrisbengali, Thanks, i really wanted to test this one out :)
Reply
Very cool, I really dig the modularity. Thanks dude!
+1 Reply
alexgrover wroclai
@wroclai, Glad you like it :) Thanks for always leaving a comment.
Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Private Messages Chat Sign Out