Concept

Polynomial Regression

Polynomial Regression is a Statistics concept. The Library holds 7 implementations, each one a working definition you can pull into Quant.

Top Polynomial Regression indicators

7 total

What is Polynomial Regression?

Polynomial regression fits a curved line to price by least squares: instead of a straight linear regression, the model adds squared, cubed, and higher powers of the bar index, then solves for the coefficients that minimize the squared distance between curve and price over a lookback window. Degree controls flexibility: degree 1 is a straight line, degree 2 a parabola with one bend, degree 3 allows two bends. Chart implementations usually draw the fitted curve through the window, often with bands offset by a multiple of the residual standard deviation, in the spirit of a standard-error channel.

The appeal is that real swings curve, and a straight fit misrepresents them; a low-degree polynomial can trace an arcing trend and expose acceleration or rollover in its right-edge slope. The costs are just as structural. Higher degrees chase noise and oscillate hardest near the window's edges, exactly where decisions are made; the entire curve is refit on every bar, so drawn history revises; and extrapolating a polynomial beyond its window is fragile, with small coefficient changes swinging the projected path widely.

How to calculate a polynomial regression

The fit is ordinary least squares with extra columns for the curvature terms.

  1. 1Choose a window N and a degree d. On charts, degree 2 or 3 covers most useful curvature; higher degrees mostly model noise.
  2. 2Build the predictors: the bar index and its powers up to d, usually centered or rescaled first for numerical stability.
  3. 3Solve the least-squares problem for the d+1 coefficients that minimize the sum of squared residuals between curve and price.
  4. 4Draw the fitted curve across the window, optionally adding bands at multiples of the residual standard deviation, and refit as each new bar arrives.

How traders use it

  • As a curved trend baseline: the right-edge slope and its change give a read on trend direction and acceleration or inflection that a straight fit smooths away.
  • As a mean-reversion frame: distance from the fitted curve, measured in residual standard deviations, flags stretched excursions, with band tags treated as fade candidates in ranging conditions rather than automatic signals.
  • As a detrender: subtracting the fitted polynomial isolates the residual wiggle, a common preprocessing step before cycle or oscillator analysis.
  • As a projection: some tools extend the curve forward as a scenario path. Treat it as a sketch of what happens if current curvature persists, not a forecast; reliability decays quickly outside the fitted window.

Polynomial Regression vs related concepts

Linear Regression: Linear regression is the degree-1 special case: one slope, no curvature. The polynomial's extra terms track arcing moves better inside the window, but they add overfitting and edge-instability risk the straight line does not have.

LOESS Smoothing: LOESS fits many small local regressions and stitches them together, so its shape is driven by neighborhoods of data. A polynomial regression fits one global curve, so a shock at one end of the window bends the fit everywhere.

Polynomial Regression Band: The band is the packaged application: the same fitted curve plus envelopes at a multiple of the residual deviation. The regression itself is the estimator; the band adds the volatility casing used for tag-and-fade or breakout reads.

More Polynomial Regression implementations

Related concepts · Regression & filtering

Concept family

Statistics

45 concepts mapped · 37 in the Library

Polynomial Regression FAQ

What degree should a polynomial regression use on charts?

Low. Degree 2 or 3 captures the curvature of most swings; each added degree buys flexibility at the cost of fitting noise and wilder behavior near the window edges. Degree is a bias-variance dial rather than a quality setting, so increase it only when residuals show clear systematic shape the current degree cannot express.

Does polynomial regression repaint?

As usually drawn, yes: the whole curve is refit each bar, so plotted history bends as new data arrives, and a touch that appeared on the curve earlier may vanish. The live right-edge value is what a system actually had at the time, so signal logic should be built on that, evaluated bar by bar (repaint-safe engineering).

Can a polynomial regression be projected into the future?

Mechanically it extrapolates, and some overlays draw the extension. Statistically it is the weakest use: outside the fitted window polynomial paths diverge quickly, and refitting one bar later can swing the projection substantially. Treat an extension as a visual scenario that assumes current curvature persists, and expect it to be revised.

Build Polynomial Regression your way.

Quant writes, tests, and refines it with you — then it runs on LuxAlgo charting or ports to TradingView.