All indicators

Savitzky-Golay Moving Average (SGMA)

A symmetric weighted average over an odd window: a fixed coefficient table for degree 2 on 5, 7 or 9 bars, and a polynomial weight shape otherwise.

BTCUSD1h
Fixed data to Oct 6, 2026, UTC
Loading the chart

The Savitzky-Golay Moving Average weights each bar of an odd-length window by a symmetric shape. Each position is mapped to x, from -1 at one end of the window to 1 at the other. The degree picks the shape: degree 0 weighs every bar the same, degree 1 is a triangle 1 - |x|, degree 2 is a parabola 1 - x^2, degree 3 is 1 - |x^3| and degree 4 is 1 - x^4. For degree 2 with a window of 5, 7 or 9 bars, a fixed table of coefficients is used instead, with small negative weights at the ends.

The weights are scaled to sum to one and the weighted sum of the source is divided by the total weight. An even period is raised by one so the window has a middle bar, and a degree the window cannot support falls back to 2. The window grows with the data until it reaches the full length, so the line starts on the first bar; a missing price is left out with its weight, and a window with no usable weights shows the source.

How to read Savitzky-Golay Moving Average (SGMA)

Read it as a smooth trend line. At the default settings (degree 2, 9 bars) the tabulated coefficients have small negative end weights, which keep more of the height of peaks and troughs than a simple average. With other settings every weight is positive: degree 1 concentrates the weight most in the middle, degree 2 a little less, and degrees 3 and 4 spread it more evenly, closer to the equal weights of degree 0. Price above a rising line describes an uptrend, and below a falling line a downtrend.

The weights are symmetric, so the line lags price by about half the window whatever the degree. Choose a short period for a responsive line and a longer one for the broad swing.

Settings

Period
The window length. An even value is raised by one so the window has a middle bar.
Polynomial Degree
The weight shape, from 0 (equal weights) to 4. Degree 1 is the most peaked; 2, 3 and 4 spread the weight progressively more evenly across the window.
Source
The price series that is averaged, the close by default.

Frequently asked questions

Why must the period be odd?

A symmetric window needs a middle bar. An even period is raised by one, so 10 behaves like 11.

What does the degree change?

The shape of the weights. Degree 0 counts every bar equally, degree 1 is a triangle and degree 2 a parabola that peaks in the middle. Degrees 3 and 4 are flatter, closer to equal weights.

Why are some weights negative at the default settings?

With degree 2 and a 5, 7 or 9-bar window the study uses a fixed table of coefficients whose end weights are slightly negative. That keeps peaks sharper than a purely positive bell would. Any other period or degree uses only positive weights.

Write your own in OpenScript

Every study here is plain OpenScript. Change a setting, combine two, or turn one into a strategy, then backtest it in /trading and run it in sandbox trading (analyzer mode in OpenAlgo) before going further.