Drawing tools · Channels

Regression channel

A regression channel fits the best straight line through the closes of a chosen period (least squares) and draws bands at ±k standard deviations of the residuals. It replaces the subjective choice of swing points by a statistical fit, and tells you how linear the trend really is through Pearson's r.

What it's for
  • Fit a statistical trend line to the closes of a chosen period, without choosing swing points.
  • Measure how linear a trend is (Pearson's r) and its average speed (the slope).
  • Spot closes that are statistically stretched, outside ±2σ.
Plus and Pro toolTry it in Analyze
Points
2: first and last bar of the period
Plan
Plus and Pro
Computed on
Closing prices
Shows
r, ±kσ in price, number of bars

How it is calculated

For the closes y of the bars between the two points, numbered x = 0 … n−1, the line minimizes the sum of squared vertical distances (ordinary least squares):

slope     = (n·Σxy − Σx·Σy) / (n·Σx² − (Σx)²)
intercept = (Σy − slope·Σx) / n
σ         = √( Σ (y − line)² / n )        root mean square of the residuals
bands     = line ± k·σ                     k = 1, 1.5, 2 (default), 2.5 or 3
r         = (n·Σxy − Σx·Σy) / √((n·Σx² − (Σx)²)·(n·Σy² − (Σy)²))

Pearson's r goes from −1 to 1: near ±1 the closes follow the line closely, near 0 there is no linear trend.

The label on the chart shows r, the band distance in price (k·σ) and the number of bars used. Extend right prolongs the line and the bands into the future with the same slope.

How to read it

Regression channel over an uptrend with r above 0.9 and most closes inside the ±2σ bands
An orderly uptrend: Pearson's r is above 0.9 and at least nine closes out of ten lie within ±2σ of the regression line.
  • The regression line is the trend's fair value for the period. Price oscillates around it.
  • The ±2σ bands. If residuals were normally distributed, about 95% of closes would fall inside; a close outside is statistically unusual for that trend, either an exhaustion or the start of a regime change.
  • Pearson's r measures how much of the movement the line explains. Above about 0.8 the channel is a good description of the trend; below about 0.5 it should not be used to trade a direction.
  • The slope, in price per bar, is the trend's average speed; comparing slopes of successive channels shows acceleration or slowdown.

Case study: the same tool on a range

A regression line can always be computed, even when there is no trend. Pearson's r is what tells the two situations apart.

Regression channel over a sideways range with r close to zero and a nearly flat line
On a sideways range, r is close to 0 and the line is almost flat: the regression says “no linear trend”. The bands still frame the range, but they describe its width, not a direction.

How to draw it

  1. Choose Channels & pitchforks → Regression channel.
  2. Click the first bar of the period, then the last one. The handles sit on the regression line.
  3. In the options, choose the band width (±1σ to ±3σ) and tick Extend right to project it.

Start the period at a clear change of trend (a major low or high). A period that mixes two regimes gives a low r and a meaningless slope.

Charts in this guide use simulated prices generated for illustration; levels and outcomes shown are examples, not observations of a real market. Educational content only, not investment advice.

Linear regression channel: least-squares trend, σ bands and Pearson's r | Oyticker