Linear regression channel
A straight best-fit line through all the prices, with two lines the same distance above and below it.
What it shows
A regression line is the straight line that sits as close as possible to all the closing prices in the window, using least squares. The channel adds a line above and below at a fixed number of standard deviations, a measure of how far prices usually stray from the line.
Unlike a trendline, nothing is anchored to a high or a low. The channel moves with every bar, and the same window always gives the same result.
How we find it
The same code that draws it on your chart follows these steps, with the same result every time.
- Take the closing prices of the last N bars (log prices for long periods).
- Fit a straight line by least squares.
- Compute the standard deviation of the distances from the line.
- Draw lines 2 standard deviations above and below the fitted line.
Starting values: Window whole period shown; Width 2 standard deviations; Price used close. These are proposed and will be tuned on real price data before launch.
How to read it
- The middle line is the average path of price over the window.
- About 95% of closes fall inside ±2 standard deviations if prices were evenly spread. Real prices often stray more.
- A steeper middle line means a faster average rise or fall.
Status labels you may see
| Label | What it means |
|---|---|
| Near the middle | Within half a standard deviation of the middle line. |
| In the upper half | Between the middle and the upper line. |
| In the lower half | Between the middle and the lower line. |
| Outside the channel | Beyond either outer line. |
What cancels it
There is nothing to cancel, because the line is a fit. It is redrawn as new bars arrive.
What traders check next
- R-squared: how closely prices follow the line.
- Whether price sits near an outer line more often than expected.
- Whether the slope changes when you change the period.
Limits
- The fit changes whenever the window changes, so the lines can shift.
- It assumes a straight path, which prices rarely follow.
- Outliers pull the line toward them.
Try it in forecastviz
- Open any ticker and choose Trendlines and channels → Linear regression channel in the left menu.
- Switch between 6M, 1Y, 3Y to see how the picture changes.
- Compare with Raff regression channel and Standard deviation channel on the same chart.
Questions
How is it different from a trendline?
A trendline touches chosen highs or lows. A regression line is a statistical fit through all prices.
Why 2 standard deviations?
It is a common default. It is a setting, not a rule of nature.
Related trends
Further reading
- Murphy, Technical Analysis of the Financial Markets
- Edwards and Magee, Technical Analysis of Stock Trends
Educational only. Not financial advice, and not a price forecast. Charts are drawn by code from past price data, which may be delayed.