# Daily Polynomial Regressions

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

Fits a fresh polynomial regression curve to each trading day's price action inside an expanding session box, colored bullish or bearish by whether the fit ends above or below the day's start. An R-squared label scores how cleanly the session is trending, guiding intraday trend-following and mean-reversion timing.

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

**Daily Polynomial Regressions** fits a best-fit curve to the current session's price action and redraws it live inside an expanding daily box. Rather than smoothing like a moving average, it solves a [polynomial regression](https://www.luxalgo.com/library/concept/polynomial-regression/) outright, the Normal Equation (X'X)B = X'Y computed in matrix form for the chosen degree, and resets every accumulator at the daily open, so the curve describes today and only today. Box and curve turn bullish or bearish depending on whether the regression's endpoint sits above or below the day's starting point; the current day's fit updates with each new bar and is subject to repainting.

## How to Trade the Daily Polynomial Regressions?

- **Curve direction and color**: the fastest read on session structure: bullish when the fitted path ends above the day's start, bearish below it.
- **R² label**: values near 1.0 mean price is hugging the curve, an orderly, trend-friendly session; low values flag chop where trend entries deserve extra caution.
- **Distance from the curve**: the fit behaves like a session-anchored mean, so stretched moves away from it mark intraday mean-reversion candidates.
- **Median line**: the optional dashed HL2 midpoint locates price within the day's high-low range.

Degree selection sets the personality: degree 1 draws a straight trend line, degree 2 captures acceleration and rounded turns, and degrees 3 to 4 flex around multiple momentum shifts at the price of more reactivity.

## Daily Polynomial Regressions Settings

- **Polynomial Degree**: complexity of the fit: lower for clean structure, higher for adaptability to intraday shifts.
- **Show Median Line**: toggles the dashed midpoint line built from the daily high-low range.
- **Show R² Label**: displays the fit-quality score at the top of the session box.
- **Bullish Color / Bearish Color / Fill Transparency**: session box styling for each regime.

## Frequently Asked Questions

### Does it repaint?

Yes, by design: the live session's regression re-solves as each new bar arrives, so the current curve keeps adjusting until the day completes. Prior days are finished fits.

### When should I raise the polynomial degree?

Start low. Degree 1 or 2 covers most directional sessions with clean output; move to 3 or 4 only when the session's swings genuinely bend more than a simple curve can express. For straight-line fits over repeating windows instead, see [Periodic Linear Regressions](https://www.luxalgo.com/library/indicator/periodic-linear-regressions/).

### How can I access Daily Polynomial Regressions?

Free through the LuxAlgo Library. This page can also push it into Quant, our coding agent, to run the regression live or backtest session ideas. You can also copy the source code from this page and run it anywhere Pine Script® runs.

## Related indicators

- [Polynomial Regression Extrapolation](https://www.luxalgo.com/library/indicator/polynomial-regression-extrapolation/) (Polynomial Regression): markdown at https://www.luxalgo.com/library/indicator/polynomial-regression-extrapolation.md
- [Spline Quantile Regression Channel](https://www.luxalgo.com/library/indicator/spline-quantile-regression-channel/) (Polynomial Regression): markdown at https://www.luxalgo.com/library/indicator/spline-quantile-regression-channel.md
- [Cubic Bézier Curve Extrapolation](https://www.luxalgo.com/library/indicator/cubic-b-zier-curve-extrapolation/) (Polynomial Regression): markdown at https://www.luxalgo.com/library/indicator/cubic-b-zier-curve-extrapolation.md
- [Bitcoin Power Law](https://www.luxalgo.com/library/indicator/bitcoin-power-law/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/bitcoin-power-law.md
- [Recursive Least Squares Forecast](https://www.luxalgo.com/library/indicator/recursive-least-squares-forecast/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/recursive-least-squares-forecast.md
- [Adaptive Harmonic Forecast](https://www.luxalgo.com/library/indicator/adaptive-harmonic-forecast/) (FFT/spectral Analysis): markdown at https://www.luxalgo.com/library/indicator/adaptive-harmonic-forecast.md
- [Kalman Filter](https://www.luxalgo.com/library/indicator/kalman-filter/) (Statistics): markdown at https://www.luxalgo.com/library/indicator/kalman-filter.md
- [Bitcoin Expectile Model](https://www.luxalgo.com/library/indicator/bitcoin-expectile-model/) (Quantile Regression): markdown at https://www.luxalgo.com/library/indicator/bitcoin-expectile-model.md

---

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