# Polynomial Regression Band

Also known as: end-point polynomial regression.
A Trend concept (Channels, lines & geometry) in the LuxAlgo Library, with 1 indicator implementation.

## What is a Polynomial Regression Band?

A polynomial regression band is a curved channel built by fitting a [polynomial](https://www.luxalgo.com/library/concept/polynomial-regression/) to recent prices with least squares, then offsetting the fitted curve above and below by a volatility measure, usually a multiple of the fit's standard deviation or root-mean-square error. Where a [linear-regression channel](https://www.luxalgo.com/library/concept/linear-regression-channel/) forces a straight line through the window, a polynomial of degree two or higher can bend with the data, so the channel follows curved trends and rounded turns more closely.

Two versions exist. The full-curve version draws the fitted polynomial across the whole lookback and refits on every new bar, so the historical segment moves as data arrives. The end-point version keeps only the newest fitted value per bar, producing a causal line that never redraws (the same idea behind the [LSMA](https://www.luxalgo.com/library/concept/lsma/), which is the end point of a linear fit). Higher degrees track price more tightly but fit noise and behave erratically near the window's edges, so extrapolating the curve forward is unreliable.

The construction has a famous commercial ancestor: the Belkhayate Center of Gravity, Mostapha Belkhayate's polynomial-band system from the MetaTrader era, which drew a fitted curve with layered rails and traded reversion from the outer bands back toward the center. Library builds in that lineage, like the Belkhayate-styled iceberg study, keep the layered-rail presentation. Offsets themselves come in flavors: fixed multiples of the residual deviation give symmetric rails, while quantile-fitted offsets let the bands honor asymmetric residuals, wider where the fit systematically misses on one side.

Deployment splits cleanly by version. The end-point line is the tradeable object: causal, honest, its slope a curvature-sensitive direction filter in the [slope-filter](https://www.luxalgo.com/library/concept/ma-slope-filter/) spirit, its crossings a smoother-turning alternative to average crossovers. The full-curve band is the analytical object: a hindsight-smoothed description of the window for studying where price sat relative to its fitted path. Mixing the two, backtesting touch rules on the refitted curve, manufactures the classic repaint illusion, which is the single most important thing to know about the tool.

## How to identify a polynomial regression band

A fit, an offset, and a version choice: the third decision matters most.

1. Choose the window and degree, two or three covering most chart uses before noise-fitting begins.
2. Fit the polynomial by least squares across the window's closes.
3. Offset the rails: multiples of the residual standard deviation or RMSE for symmetric bands, quantile fits for asymmetric ones.
4. Choose the version deliberately: full-curve for display and research, end-point for anything that feeds signals or tests.
5. Read touches by regime: outer-rail tags fade-worthy in rotation, riding rails normal in trends, with the end-point slope as the regime hint.

## How it's calculated

A least squares polynomial fit of price over a lookback window, with bands offset from the fit by a multiple of the residual deviation.

```
x_i = i for i = 0..n-1 (bar position within the window)
F_i = b_0 + b_1 × x_i + b_2 × x_i^2 + ... + b_k × x_i^k
b_0 .. b_k minimize Σ (P_i - F_i)^2 over i = 0..n-1 (ordinary least squares)
sigma = sqrt( (Σ (P_i - F_i)^2 over i = 0..n-1) / n )
Upper_i = F_i + m × sigma
Lower_i = F_i - m × sigma
End-point variant: on each new bar, refit the window and keep only the newest fitted value F_{n-1}; the plotted line is the trail of those end points.

  n: window length in bars (commonly around 100; varies by platform)
  k: polynomial degree (commonly 2 to 4; k = 1 gives a linear regression channel)
  i: bar position within the window, 0..n-1
  x_i: regressor, the bar position i
  P_i: source price at position i (usually the close)
  F_i: fitted polynomial value at position i (F_{n-1} is the newest, at i = n-1)
  b_0 .. b_k: least squares coefficients
  sigma: standard deviation of the fit residuals over the window
  m: band width multiplier (commonly 2)
  Upper_i: upper band at position i
  Lower_i: lower band at position i
```

The whole in-window fit is recomputed as the window slides, so drawn history repaints; the end-point variant never revises past points.

Some versions offset the bands by the maximum absolute residual or an ATR multiple instead of sigma.

High degrees fit noise and swing hard near the window edges, so k above 4 is rarely used.

## How traders use it

- As curved dynamic support and resistance: pullbacks toward the lower band in a rising fit, or the upper band in a falling one, are watched for reactions, with band width scaling to how loosely price sits around the curve.
- As a mean-reversion frame inside the window: price stretched to an outer band is treated as extended relative to the fitted curve, a context read rather than a standalone signal, since strong trends can ride a band for many bars.
- As a smoother trend proxy: the slope of the end-point line gives a direction filter that picks up curvature sooner than a straight regression line, at the cost of more noise sensitivity as the degree rises.
- In Belkhayate-style reversion systems: entries staged at the outer rails targeting the center curve, gated by a regime check so trend days, when rails ride rather than reject, are excluded.
- As crossover material: price or a fast average crossing the end-point line gives turn signals that bend with the market, a curved alternative to straight [moving average crossovers](https://www.luxalgo.com/library/concept/moving-average-crossovers/) with the same confirmation trade-offs.

## Polynomial bands vs related channels

- **Linear Regression Channel** (https://www.luxalgo.com/library/concept/linear-regression-channel/): The straight-line special case: one slope across the window, rails parallel to it. The polynomial version buys curvature, following arcing trends the line misrepresents, and pays with extra parameters, noise sensitivity, and livelier edge behavior.
- **MA Envelope** (https://www.luxalgo.com/library/concept/ma-envelope/): The envelope offsets a moving average, a causal smoother with lag; the band offsets a least-squares fit, lag-free inside the window but refit-revised. Same rail grammar, different centerlines, and the difference is exactly lag versus hindsight.
- **LSMA** (https://www.luxalgo.com/library/concept/lsma/): The LSMA is the end-point idea at degree one: the newest value of a rolling linear fit, plotted causally. The polynomial end-point line generalizes it to curved fits, and the band adds the volatility casing around either.

## FAQ

### Does a polynomial regression band repaint?

The full-curve version does: every new bar refits the polynomial, so the drawn history shifts. The end-point version does not, because each bar keeps only the fitted value plotted when that bar was current. When testing rules built on the band, use the end-point form or evaluate touches only on data that was available at the time.

### What polynomial degree should the band use?

Degree two or three covers most charting uses: enough curvature to follow rounded trends without wild oscillation. Higher degrees start fitting the window's noise and swing sharply near its edges, which destabilizes both the curve and its bands. There is no single optimal degree; the choice trades smoothness against responsiveness, so keep it low unless the data clearly bends more.

### What is the Belkhayate Center of Gravity?

A polynomial-band trading system popularized by Mostapha Belkhayate in the MetaTrader ecosystem: a fitted curve as the center of gravity, layered rails above and below, and a playbook of fading the outer rails back toward the center. Its visual style, multiple colored bands around a bending centerline, survives in the chart builds descending from it. The honest caveats are the construction's own: refit revision and trend days that ride the rails.

### How are the band offsets calculated?

The common construction measures the fit's residuals, price minus fitted value across the window, and offsets the rails by a multiple of their standard deviation or RMSE, so band width reflects how loosely price sits around the curve. Quantile variants fit rails through chosen percentiles of the residuals instead, letting the channel sit asymmetrically when the misses genuinely skew one way. Either way the width inherits the window: change the lookback and the casing changes with it.

### Should signals use the full curve or the end-point line?

The end-point line, almost always. It is causal, never redraws, and represents what a trader actually had at each bar; the full curve is a hindsight object whose historical touches were computed with data that did not yet exist. The full version earns its keep for display and research, describing how price danced around its fitted path, provided its touch history is never mistaken for a tradeable record.

### Can the fitted curve be projected forward?

Mechanically yes, credibly no. Polynomials are unstable exactly where projection needs them, beyond the data, and small window changes swing the extension widely; the refit one bar later routinely contradicts the projection made one bar earlier. Treated as a sketch of what happens if current curvature persists, an extension has scenario value; treated as a forecast, it is the textbook misuse of the tool.

## Implementations in the Library

- Polynomial Regression Band (LuxAlgo): https://www.luxalgo.com/library/indicator/polynomial-regression-band/

## Related concepts

- Trendline: https://www.luxalgo.com/library/concept/trendline/
- Linear-regression Channel: https://www.luxalgo.com/library/concept/linear-regression-channel/
- Parallel Channel: https://www.luxalgo.com/library/concept/parallel-channel/
- Fan Principle: https://www.luxalgo.com/library/concept/fan-principle/
- Standard-error Channel: https://www.luxalgo.com/library/concept/standard-error-channel/
- Andrews' Pitchfork: https://www.luxalgo.com/library/concept/andrews-pitchfork/
- Gann Fan & Angles: https://www.luxalgo.com/library/concept/gann-fan-and-angles/
- Gann Box: https://www.luxalgo.com/library/concept/gann-box/
- Gann Square of 9: https://www.luxalgo.com/library/concept/gann-square-of-9/
- Speed Resistance Lines: https://www.luxalgo.com/library/concept/speed-resistance-lines/

---

Source: https://www.luxalgo.com/library/concept/polynomial-regression-band/ (LuxAlgo Library, the encyclopedia of trading & technical analysis). Free to use with attribution: https://www.luxalgo.com/library/license/