Linear Regression Channel
By Chad Smith, Director of Research & Analysis · Updated
On this page
A linear regression channel is a trend tool that fits a straight best-fit line through a chosen set of prices and draws parallel bands above and below it. The middle line comes from the least squares method, a standard statistical technique. The bands are usually set a number of standard deviations away from the line. The channel shows the trend's direction, its steepness and how far price has strayed from it.
What it measures
A linear regression channel measures the average trend over a period and the spread of prices around that trend. The middle line is the single straight line that fits the prices best. Its slope shows the direction and rate of the trend. The bands show how widely prices have scattered around it.
When price sits near the middle line, it is close to its trend value. When it reaches an outer band, it is unusually far from the trend for that period. That makes the channel useful both for reading the trend and for spotting stretched moves within it.
Unlike a moving average, which curves with price, the regression line is straight. It describes the trend over the whole window in one slope.
The formula
For N bars, with x = bar number (1 to N) and y = closing price:
Slope (b) = (N × Σxy − Σx × Σy) / (N × Σx² − (Σx)²)
Intercept (a) = (Σy − b × Σx) / N
Regression line value at bar x: ŷ = a + b × x
Standard deviation of residuals:
SD = √( Σ(y − ŷ)² / N )
Upper channel = ŷ + k × SD
Lower channel = ŷ − k × SD
where
N = the number of bars in the channel (often 100)
k = the number of standard deviations (often 2)
Some versions use the standard deviation of price instead of the residuals, and some set the bands at the farthest high and low from the line. The idea is the same: a central trend line plus bands that measure dispersion.
Worked example (illustrative numbers). Take five closes: 10, 11, 13, 12 and 14, at bars 1 to 5. Σx = 15, Σy = 60, Σxy = 10 + 22 + 39 + 48 + 70 = 189, and Σx² = 55. Slope = (5 × 189 − 15 × 60) / (5 × 55 − 225) = (945 − 900) / 50 = 0.9. Intercept = (60 − 0.9 × 15) / 5 = 46.5 / 5 = 9.3. The line runs from 10.2 at bar 1 to 13.8 at bar 5. The residuals are −0.2, −0.1, 1.0, −0.9 and 0.2, whose squares sum to 1.9. SD = √(1.9 / 5) ≈ 0.62. With k = 2, the bands sit about 1.24 above and below the line.
Default settings
| Setting | Common value |
|---|---|
| Length | 100 bars (platform defaults vary) |
| Deviation multiplier | 2 |
| Source | Close |
The linear regression channel is built into TradingView and MetaTrader, usually as a drawing tool or study that can be anchored to chosen dates or to the latest bars.
How to read it
Slope. An upward slope shows an uptrend over the window; a downward slope shows a downtrend; a flat slope shows a range.
Position within the channel. Price near the upper band in an uptrend is stretched above its trend. Price near the lower band is below its trend value and may represent a pullback.
Breaks of the channel. A close outside the channel, especially against the slope, can warn that the trend over the period is changing. A close outside in the direction of the slope can show acceleration.
Channel width. A narrow channel shows prices hugging the trend line. A wide channel shows a noisier trend.
Regression channels vs Bollinger Bands and trend channels
Bollinger Bands use a moving average and standard deviation, so they curve and update with every bar. A regression channel uses a straight line fitted to a fixed window. Bollinger Bands describe recent volatility around a recent average; the regression channel describes the whole window's trend and dispersion.
Hand-drawn trend channels connect chosen highs and lows. Different traders draw different channels. The regression channel is calculated from every price in the window, so once the window is chosen, it is the same for everyone.
Standard deviation and the regression channel share the same dispersion idea. The channel applies it around a trend line rather than around a flat average.
Common strategies
Trend pullbacks to the lower band
In an upward-sloping channel, buy when price pulls back to the lower band and shows a reversal, such as a hammer. The target is the middle line or the upper band. The stop-loss goes below the channel.
Mean reversion to the middle line
When price reaches an outer band, look for a move back toward the regression line. This works best when the slope is steady and the channel has contained price well.
Channel break as a trend change
A close outside the channel against its slope suggests the trend over the window may be ending. Traders tighten stops on existing positions or look for a new channel to form.
Multiple channel lengths
Draw a long channel for the main trend and a short one for the current swing. When both slopes agree, the trend has support on both scales.
Weaknesses
The channel depends on the window. A different start point or length can give a very different slope and width.
Channels tied to the latest bars recalculate every bar, so past sections of the channel shift. Signals that look clean on a historical chart may not have looked the same in real time.
A straight line can misfit curved trends. Accelerating or decelerating markets do not follow a straight line, so the channel can be misleading.
The statistics are approximate. Price changes do not follow a neat normal distribution, so band levels describe spread loosely rather than precisely.
Indicators it pairs with
- Standard deviation, which sets the channel width.
- Bollinger Bands, for a dynamic comparison.
- RSI or the stochastic oscillator, to confirm stretched moves at the bands.
- ADX, to check that a trend exists before trading channel pullbacks.
- ZigZag, to choose clear swing points as the channel's start.
For more on trends and channels, see the technical analysis course.
Brokers with strong charting to practice on
Put this into practice on a demo account first, with no money at risk.
- Featured broker
Pepperstone4.7 / 5Visit
IC Markets4.9 / 5Visit
GO Markets4.8 / 5Visit
Frequently asked questions
What is a linear regression channel?
It is a straight best-fit line drawn through a chosen period of prices, with parallel bands above and below. The bands are usually set a number of standard deviations from the line.
How is the regression line calculated?
It uses the least squares method, which finds the straight line that minimizes the total squared distance between the line and the prices.
What does the slope of the channel tell you?
The slope shows the direction and steepness of the trend over the chosen period. An upward slope suggests an uptrend and a downward slope suggests a downtrend.
How is a regression channel different from a hand-drawn trend channel?
A hand-drawn channel depends on which highs and lows the trader connects. A regression channel is calculated from all prices in the period, so it is objective once the period is chosen.
Does the regression channel repaint?
When a channel is tied to the latest bars, its whole line is recalculated with each new bar, so the past part of the channel can shift. Fixed channels drawn between two dates do not change.