# Polynomial Regression Band

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

Fits a degree-2 polynomial to the last 100 closes by least squares and wraps the curve in bands 2 residual standard deviations wide. A causal end-point line colored by slope never redraws and drives every alert, while an honestly repainting fitted curve shows the current window's full channel. Eight alerts cover band crosses, re-entries, slope turns, and with-trend pullbacks.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jun 24, 2026.
- Access: free.
- Concepts: [Polynomial Regression Band](https://www.luxalgo.com/library/concept/polynomial-regression-band/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=j6naadpyfm3u1g01csgda0f5
- Page: https://www.luxalgo.com/library/indicator/polynomial-regression-band/

**Polynomial Regression Band** fits a degree-2 polynomial to the last 100 bars by least squares and offsets the fit by a multiple of its residual standard deviation, for a channel that curves with the trend rather than averaging it into a straight line. This definitive clean build of the [polynomial regression band](https://www.luxalgo.com/library/concept/polynomial-regression-band/) separates the tool's two versions: a causal end-point line keeping only the newest fitted value per bar (never redrawing, the series every alert measures against) and the current window's full curve, which openly re-fits on every bar.

## How to Trade the Polynomial Regression Band?

- **Slope turns**: the end-point line flipping direction is the trend read; both turns fire alerts.
- **Band pullbacks**: a wick into the lower band while the fit rises (or the upper while it falls) is the pullback watched as curved dynamic support or resistance.
- **Band closes and re-entries**: a close beyond a band marks stretch (a context read, since strong trends can ride a band) and the close back inside frames mean reversion toward the fit.

Only the end-point series suits rule testing: a live alert matches its plotted history. The curve is context, deliberately not extended past the last bar: extrapolation is unreliable.

## Polynomial Regression Band Settings

- **Source** (default close): series the polynomial is fitted to.
- **Length** (default 100): the rolling fit window. Shorter hugs recent swings, longer smooths them.
- **Degree** (default 2): the fit's polynomial degree.
- **Band Multiplier** (default 2): half-width of the channel in residual standard deviations.
- **End-Point Band** (default enabled): the causal line and its bands.
- **Fitted Curve (Repaints)** (default enabled): the current window's curved channel.
- **Gradient Fill** (default enabled): shading from the fit to each band; remaining Style inputs set colors.

## Frequently Asked Questions

### How is this different from Linear Regression?

A straight-line fit like [Linear Regression](https://www.luxalgo.com/library/indicator/linear-regression/) assumes one constant direction across the window, so it lags through rounded turns. From degree 2 upward the fit can curve inside the window. Degree 1 would simply reproduce the linear case.

### Why does the fitted curve move on every bar?

Each new bar re-fits the polynomial over the newest window, so the drawn segment shifts as data arrives, the nature of any windowed fit. Hence the end-point series, and why alerts are evaluated against it.

### What degree should I use?

The default of 2, or 3, covers most charting uses: enough curvature for rounded trends without wild oscillation. Raise it only when the data clearly bends more. The cost is noise-fitting and unstable behavior near the window's edges.

## Related indicators

- [Volumetric Regression Heatmap](https://www.luxalgo.com/library/indicator/volumetric-regression-heatmap/) (Linear-regression Channel): markdown at https://www.luxalgo.com/library/indicator/volumetric-regression-heatmap.md
- [Trendlines with Breaks](https://www.luxalgo.com/library/indicator/trendlines-with-breaks/) (Trendline): markdown at https://www.luxalgo.com/library/indicator/trendlines-with-breaks.md
- [Trendline Breakout Navigator](https://www.luxalgo.com/library/indicator/trendline-breakout-navigator/) (Trendline): markdown at https://www.luxalgo.com/library/indicator/trendline-breakout-navigator.md
- [FVG Channel](https://www.luxalgo.com/library/indicator/fvg-channel/) (Parallel Channel): markdown at https://www.luxalgo.com/library/indicator/fvg-channel.md
- [Gann Square of 9 Vibration Levels](https://www.luxalgo.com/library/indicator/gann-square-of-9-vibration-levels/) (Gann Square of 9): markdown at https://www.luxalgo.com/library/indicator/gann-square-of-9-vibration-levels.md
- [Trendlines with Breaks Oscillator](https://www.luxalgo.com/library/indicator/trendlines-with-breaks-oscillator/) (Trendline): markdown at https://www.luxalgo.com/library/indicator/trendlines-with-breaks-oscillator.md
- [Zig Zag Channels](https://www.luxalgo.com/library/indicator/zig-zag-channels/) (Parallel Channel): markdown at https://www.luxalgo.com/library/indicator/zig-zag-channels.md
- [Volume Profile Regression Channel](https://www.luxalgo.com/library/indicator/volume-profile-regression-channel/) (Linear-regression Channel): markdown at https://www.luxalgo.com/library/indicator/volume-profile-regression-channel.md

---

Source: https://www.luxalgo.com/library/indicator/polynomial-regression-band/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
