anieri

Savitzky-Golay Smoothing Filter

The Savitzky-Golay Filter is a polynomial smoothing filter.
This version implements 3rd degree polynomials using coefficients from Savitzky and Golay's table, specifically the coefficients for a 5-, 7-, 9-, 15- and 25-point window moving averages.
The filters are offset to the left by the number of coefficients (n-1)/2 so it smooths on top of the actual curve.
You can turn off some of the smoothing curves, as it can get cluttered displaying all at once.
Any feedback is very welcome.
Release Notes: Savitzky-Golay digital filter, useful for smoothing data.
This script implements the 5-, 7-, 9-, 15-, and 25-point window 3rd degree polynomial fit coefficients.
The plots are offset by (n-1)/2 where n is the window size, so it fits the original data.
Any feedback is welcome.
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?

Comments

what you think of multi staging this filter for noise reduction, i tried something with it, but never got around to do much with it and ended up forgotten.
Reply
anieri RicardoSantos
@RicardoSantos, I've found it very useful to apply it more than once to the same input, although I do not fully understand the consequences of doing so.
One of the nicest uses was to further smooth a simple moving average (which is not far from the savitzky-golay filter): when you take, for example, a derivative of the smoothed SMA, you get much nicer results.
Reply
@anieri, ok, thank you for the reply
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