# Linear Regression Fan

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

Fits a least-squares linear regression over a chosen window and fans rays out from a common origin at the window's start, evenly spaced at its end, with the outermost rays one root-mean-square deviation times an adjustable multiplier from the fit. The rays serve as sloped support and resistance, with extremity breaks suited to measured-move targeting. A compact framework for traders working graded trend levels.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Oct 11, 2021.
- Access: free.
- Concepts: [Linear Regression](https://www.luxalgo.com/library/concept/linear-regression/) (primary), [Fan Principle](https://www.luxalgo.com/library/concept/fan-principle/)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=cmpwn2ums003yvhsg4iffige6
- Page: https://www.luxalgo.com/library/indicator/linear-regression-fan/

**Linear Regression Fan** anchors a fan of equidistant lines to a least-squares [linear regression fit](https://www.luxalgo.com/library/concept/linear-regression/) of price, spacing them by the fit's root-mean-square deviation multiplied by an adjustable factor. The rays originate at the regression's first point and extend to its most recent, a fit-driven relative of the classical [fan principle](https://www.luxalgo.com/library/concept/fan-principle/), giving a trend graded internal levels instead of a single midline.

## How to Trade the Linear Regression Fan?

- **Rays as sloped support and resistance**: the equidistant lines mark graded reaction levels inside the move, from the fit outward.
- **Anchor at a pivot**: place the Left Coordinate on the swing point that began the move, so the fit starts there. The fan then grades everything that followed.
- **Extremity breaks**: when price escapes the outermost lines, the measure rule of broadening wedges can be applied to project take-profit and stop-loss levels.

Mult trades coverage for precision: a larger multiplier widens the fan to contain more of the action, while a smaller one tightens it so breaks register earlier. Lines Per Side adds intermediate rays when a denser ladder of levels helps.

## Linear Regression Fan Settings

- **Left Coordinate** / **Right Coordinate**: the start and end of the regression window, picked on the chart; place the left point on the pivot you care about.
- **Mult**: multiplies the RMSD spacing, widening or narrowing the fan.
- **Lines Per Side**: how many rays are drawn on each side of the fit.
- **Src**: the price source the regression runs on.

## Frequently Asked Questions

### How do I pick the anchor point?

Place the Left Coordinate on a meaningful pivot high or low, so the regression's first bar lands there. Anchored that way, the rays describe the trend that grew out of that pivot, and reactions at the lines carry more information.

### How does it compare with a plain regression tool?

The standalone [Linear Regression](https://www.luxalgo.com/library/indicator/linear-regression/) build centers on the fitted line itself. The fan converts one fit into a full set of sloped levels, which suits traders who want intermediate support and resistance inside the trend rather than a midline alone.

### How can I access the Linear Regression Fan?

The tool is free to use in the LuxAlgo Library. It can also be run in Quant, our coding agent, straight from this page, handy for trying different lengths and multipliers. You can also copy the source code from this page and run it anywhere Pine Script® runs.

## Related indicators

- [Linear Regression Histogram](https://www.luxalgo.com/library/indicator/linear-regression-histogram/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/linear-regression-histogram.md
- [Periodic Linear Regressions](https://www.luxalgo.com/library/indicator/periodic-linear-regressions/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/periodic-linear-regressions.md
- [Rolling Segment](https://www.luxalgo.com/library/indicator/rolling-segment/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/rolling-segment.md
- [Rolling Trendline](https://www.luxalgo.com/library/indicator/rolling-trendline/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/rolling-trendline.md
- [Extrapolated Previous Trend](https://www.luxalgo.com/library/indicator/extrapolated-previous-trend/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/extrapolated-previous-trend.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
- [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

---

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