Overlays · Indicator

Linear Regression Channel LinReg

A least-squares best-fit line through recent closes with deviation bands, showing the statistical trend and how far price has strayed from it.

Open in chart

Overview

The Linear Regression Channel fits a least-squares best-fit line through closing prices over N bars, with upper and lower bands at one standard deviation. The centre line is the straight line that minimises the total squared distance to every close in the window, which makes it the mathematically defined trend for that period rather than a smoothed version of price. Prices near the outer bands may be over-extended relative to trend.

The difference from a moving average is worth understanding. A moving average tells you the average price over the window and therefore always sits behind a trending market. A regression line tells you the direction and rate of change over the window and ends at the current bar, so it is centred on price rather than trailing it. The slope of the line is a direct estimate of how fast the market has been moving per bar.

The bands measure dispersion around the fitted line rather than around an average, which is a cleaner definition of 'off trend' in a market that is genuinely moving. In a steady advance, a moving average sits well below price and its bands are stretched around the lag; a regression channel runs through the middle of the advance and its bands measure how tidy the advance has been.

How it is calculated

Ordinary least squares is applied to the last N closes against their bar index, producing an intercept and a slope. Evaluating that equation at each bar gives the centre line. The standard deviation of the closes about the fitted line is then computed, and the bands are placed a multiple of that deviation above and below.

The whole channel is refitted on every bar. When a new bar arrives the oldest close leaves the window and the fit changes, which means the historical position of the channel is not fixed: the line drawn over past bars today is not necessarily the line that was drawn over those bars at the time.

Fit close = a + b * x by least squares over the last N bars
Basis = the fitted line evaluated at each bar
Deviation = standard deviation of close about the fitted line
Upper = Basis + Multiplier * Deviation
Lower = Basis - Multiplier * Deviation

Inputs

Length
Number of bars the regression is fitted over, default 100. This is the single most important setting, because it decides which move the channel describes. A short length fits the latest swing; a long one fits the broader trend.
Standard deviations
How many standard deviations the outer bands sit from the fitted line, default 1. At one deviation roughly two thirds of closes fall inside the channel, so touches are frequent; raising it to 2 makes touches much rarer.

How to read it

The slope is the headline reading. A steeply rising centre line means the market has advanced at a consistent rate over the window; a flat line means the window contains no net direction regardless of how much movement occurred inside it. Slope is a rate, so it can be compared between periods on the same instrument.

Channel width tells you how well the trend fits. A narrow channel means closes have clustered tightly around the line, describing an orderly trend that has respected its own pace. A wide channel means the same net move happened through large swings, which is a less reliable structure to lean on.

Position within the channel is the mean-reversion read. Price near the upper band has run ahead of its own trend line and price near the lower band has fallen behind it. Note that in a rising channel, touching the lower band still means price is in an uptrend, just at the weak end of it, which is why the channel is used for pullback entries as often as for fades.

Signals to look for

Band touch within trend

In a rising channel, a touch of the lower band is watched as a pullback to the weak edge of an ongoing trend; in a falling channel the upper band plays the same role. Both are continuation references rather than reversals.

Channel break

A close well outside the channel says price has departed from the pace the window describes, either through an acceleration or a breakdown. It often signals that the fitted trend is about to change.

Slope flattening

A centre line whose slope decays towards zero over successive bars describes a trend losing its rate of advance, which traders read as a loss of momentum even while price is still making progress.

Limitations

Frequently asked questions

What is Linear Regression Channel (LinReg)?

A least-squares best-fit line through recent closes with deviation bands, showing the statistical trend and how far price has strayed from it.

How do you read LinReg on a chart?

The slope is the headline reading. A steeply rising centre line means the market has advanced at a consistent rate over the window; a flat line means the window contains no net direction regardless of how much movement occurred inside it. Slope is a rate, so it can be compared between periods on the same instrument.

What signals do traders look for with LinReg?

Band touch within trend: In a rising channel, a touch of the lower band is watched as a pullback to the weak edge of an ongoing trend; in a falling channel the upper band plays the same role. Both are continuation references rather than reversals.

What are the limitations of LinReg?

The channel repaints as it refits. Adding one bar changes the whole line, so past channel positions on a historical chart never show what a trader would actually have seen at the time.

Related indicators

Bollinger BandsMoving AverageDonchian ChannelsVWAP Standard Deviation Bands

Open in chart Start free trial All indicators