# Savitzky-Golay Filter

Savitzky-Golay Filter is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Savitzky-Golay polynomial smoothing that keeps the height and timing of swings. The textbook centered fit is drawn at each bar once its window has closed, a dotted edge marks the newest bars that are still provisional, and the slope of the real-time fit drives long signals that exit on the next downturn. A dashboard reports slope, curvature and the noise each fit passes.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jun 11, 2026.
- Access: free.
- Concepts: [Savitzky-Golay filter](https://www.luxalgo.com/library/concept/savitzky-golay-filter/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=vau4mwd88ry3mcx2vtvftzl1
- Page: https://www.luxalgo.com/library/indicator/savitzky-golay-filter/

The **Savitzky-Golay Filter** is a sophisticated signal processing tool that performs a least-squares polynomial fit over a defined window of data to smooth price action while preserving the essential shape of peaks and troughs. Unlike traditional moving averages that inherently introduce significant lag and flatten out critical price turning points, the Savitzky-Golay approach effectively balances noise reduction with trend fidelity. By calculating the derivative of the fitted polynomial, traders can identify shifts in momentum and local price trends with improved accuracy, providing a distinct analytical advantage in both trending and ranging market environments.

## How to Trade the Savitzky-Golay Filter?

Trading with the Savitzky-Golay Filter primarily involves monitoring the slope of the real-time polynomial fit. A positive slope indicates a bullish trend, while a negative slope suggests bearish momentum. Traders often look for a slope reversal to signal potential entry or exit points.

To filter out insignificant price fluctuations, use the Minimum Slope setting, which requires the fitted slope to exceed a specific threshold of the Average True Range (ATR) before a signal is triggered. This helps avoid "whipsaw" entries during low volatility or sideways consolidation. When the signal is active, the indicator identifies the trend direction, allowing you to enter long positions when the slope turns positive and short positions when it turns negative. The provisional edge, shown as a dotted line, provides an early look at the trajectory of the newest data points, allowing for proactive analysis before the filter is finalized.

## Savitzky-Golay Filter Settings

### Savitzky-Golay Fit
* **Source**: The data series used for the polynomial calculation.
* **Half Width (m)**: Determines the window size as 2m + 1 bars. Larger values increase smoothing but may introduce more latency.
* **Polynomial Degree**: The degree of the fitted polynomial. Higher degrees follow price curves more closely but may include more market noise.
* **History (bars)**: The total look-back period for drawing the confirmed filter.
* **Show Provisional Edge**: Enables the display of the current, non-finalized polynomial fit for the most recent bars.
* **Mark Confirmed Peaks / Troughs**: Places labels at significant turning points once they are verified by the look-back window.

### Slope Turns
* **Signals**: Chooses Long & Short, Long Only (the default) or Off; short signals print only with Long & Short.
* **Minimum Slope (ATR per bar)**: Sets the sensitivity of the slope turn detection. Increasing this value requires a stronger move to trigger a signal.
* **Show Trades**: Displays visual cues for entries and exits on the chart.

### Style
* **Line Width**: Adjusts the thickness of the filter line.
* **Rising/Falling**: Color configuration for the filter trajectory.
* **Provisional Edge/Neutral**: Provisional Edge colors the dotted, non-finalized edge of the line; Neutral colors the exit labels.

### Dashboard
* **Show Dashboard**: Toggles the on-screen data panel.
* **Position/Size**: Adjusts the placement and scaling of the summary dashboard.

## Frequently Asked Questions

### Why does the indicator line appear as a dotted segment at the end?
The dotted segment represents the provisional edge, which is the real-time estimate of the polynomial fit. Because the filter uses a window of future bars to finalize a point, these most recent bars are subject to revision as new data arrives and are therefore marked distinctly.

### How does the Polynomial Degree affect my trading?
A lower degree acts similarly to a simple moving average, providing high levels of smoothing but potentially losing peak detail. A higher degree allows the filter to track rapid price changes and curvature more precisely, but it may also capture unwanted noise.

### Can this indicator be used to filter out noise in sideways markets?
Yes, by adjusting the Minimum Slope setting, you can ensure that signals only trigger when the price momentum is sufficiently strong. This prevents the indicator from generating signals during periods of low volatility or range-bound consolidation where the slope is effectively flat.

## Related indicators

- [Chebyshev Filters](https://www.luxalgo.com/library/indicator/chebyshev-filters/) (Trend): markdown at https://www.luxalgo.com/library/indicator/chebyshev-filters.md
- [Laguerre Filter](https://www.luxalgo.com/library/indicator/laguerre-filter/) (Trend): markdown at https://www.luxalgo.com/library/indicator/laguerre-filter.md
- [Elliptic Filter](https://www.luxalgo.com/library/indicator/elliptic-filter/) (Trend): markdown at https://www.luxalgo.com/library/indicator/elliptic-filter.md
- [Gaussian Filter](https://www.luxalgo.com/library/indicator/gaussian-filter/) (Trend): markdown at https://www.luxalgo.com/library/indicator/gaussian-filter.md
- [Swiss Army Knife Filter](https://www.luxalgo.com/library/indicator/swiss-army-knife-filter/) (Trend): markdown at https://www.luxalgo.com/library/indicator/swiss-army-knife-filter.md
- [Ehlers SuperSmoother](https://www.luxalgo.com/library/indicator/ehlers-supersmoother/) (Trend): markdown at https://www.luxalgo.com/library/indicator/ehlers-supersmoother.md
- [Ehlers Instantaneous Trendline](https://www.luxalgo.com/library/indicator/ehlers-instantaneous-trendline/) (Trend): markdown at https://www.luxalgo.com/library/indicator/ehlers-instantaneous-trendline.md
- [Whittaker Envelope](https://www.luxalgo.com/library/indicator/whittaker-envelope/) (Whittaker–Henderson Smoother): markdown at https://www.luxalgo.com/library/indicator/whittaker-envelope.md

---

Source: https://www.luxalgo.com/library/indicator/savitzky-golay-filter/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
