Skip to content
TraderCalcs.io

Standard Deviation Channel Calculator

Fit a linear regression line through a price series and place channel lines a chosen number of deviations either side.

A standard deviation channel calculator fits an ordinary least squares line through a series of prices and places two parallel lines a chosen number of residual standard deviations either side of it. The fitted line is the one that minimises the sum of the squared vertical distances from the prices to it, and the channel width summarises how far those prices scattered around it. Charting platforms label the identical construction a linear regression channel calculator; under either name, both lines come entirely from a series you type in yourself, oldest price first.

Formula: channel = regression line +/- (k x standard deviation of the residuals)

Your figures

Price series

In time order, oldest first — one closing price per row. Blank rows are ignored. The row number is used as the x value, so the rows are treated as evenly spaced.

Price 1
Price 2
Price 3
Price 4
Price 5
Price 6
Price 7
Price 8
Price 9
Price 10
Price 11
Price 12
Price 13
Price 14

How many residual standard deviations the channel lines sit from the fitted line. Two is the usual default; it is a convention, not a property of the series.

Only used when the count above is set to Custom.

Packages use both. The fitted line is the same either way — only the width of the channel changes.

Optional — reports where your price sits between the two channel lines. It is not added to the series and does not move the fit.

The channel

Fitted line at the latest point

105.84

channel from 105.05 to 106.63 at 2.00 deviations

Upper channel lineThe fitted line plus 2.00 × the residual standard deviation.
106.63
Fitted line at the latest pointWhere the least squares line falls at the last row entered.
105.84
Lower channel lineThe fitted line minus 2.00 × the residual standard deviation.
105.05
Channel widthUpper minus lower, which is twice the deviation count times the residual spread.
1.58
Residual standard deviationMeasured on the population denominator. The residuals of a least squares fit sum to zero, so this is a root mean square about zero rather than about an estimated mean.
0.3949
Slope per period+0.4259% of the fitted value at the latest point, per period.
+0.4508
Fitted value at the first pointThe intercept, because x starts at zero on the first row. A package that indexes from one reports a figure one slope lower for the identical fit.
99.98
R²The share of the variation in the prices entered that the straight line accounts for. It does not say whether a straight line is the right shape.
95.49%
Latest price in the series+0.2629 from the fitted line.
106.10
Prices usedBlank rows were dropped before fitting.
14
Convention used2.00 deviations either side. The fitted line is identical on either denominator; only the channel width changes.
Population (÷ n)
Where your price sits in the channel0% is the lower line and 100% the upper, measured at the latest point.
47.65%

What this means

A least squares line through the 14 prices entered changes by +0.4508 per period and reaches 105.84 at the last row. The gaps between the prices and that line have a standard deviation of 0.3949 on the population denominator, so lines 2.00 deviations either side fall at 105.05 and 106.63, a width of 1.58. An R² of 95.49% is the share of the variation in those prices that the straight line accounts for. The price you entered, 105.80, sits 47.65% of the way from the lower line to the upper one. The fit is recalculated from every price in the list, so adding one more moves the line and both channel lines with it. This describes the series you entered; it does not extend it.

  • The residual spread is offered on two denominators because packages use both. Dividing by n treats the residuals as the whole population; dividing by n − 2 pays a degree of freedom for the slope and the intercept the line already spent on the same data. The fitted line is identical either way, and the standard error basis is never the narrower of the two.
  • A regression channel is refitted from scratch every time a price is added: the slope, the intercept and both channel lines move with it. The lines drawn across last month were not in those places last month, which is what separates this from a pivot calculated once from a period that has closed.
  • The row number is used as the x value, so the rows are treated as evenly spaced. A weekend or a missing bar is fitted as though those rows were adjacent — the same assumption a charting package makes when it draws a channel over daily bars.
  • R² reports how much of the variation a straight line accounts for. A high figure says the prices entered sit close to a line, not that a line is the right shape for them or that it continues.
  • A level is a price a formula produces from figures that have already printed. Reaching one is not evidence that it holds, and nothing on this page is a view on which way the next period goes.
  • Nothing is fetched. Every figure above is one you typed, which is what lets the same calculator serve this morning's bar, a weekly bar from years ago, and an instrument no data provider covers.

Fitted line at the latest point: 105.84

The link reopens this calculator with the same numbers. Nothing you enter is sent to a server.

About the Standard Deviation Channel calculation

The row number is used as the x value, so every row is treated as one period after the last regardless of what happened in between. A weekend, a holiday or a missing bar is fitted as though those rows were adjacent — the same assumption a charting package makes when it draws a regression channel over daily bars, and worth knowing rather than discovering later.

There is one property to understand before reading anything into a channel: it is refitted from scratch every time a price is added. The slope changes, the intercept changes, and every historical channel line moves with them. The lines a regression channel trading platform shows drawn across last month were not in those places last month. That is not a defect in the method, but it is what makes a channel line a description of the data so far rather than a fixed level in the way a pivot point is.

The residual spread is offered on two denominators rather than settled silently, because charting packages use both: dividing the sum of squared residuals by n, or by n − 2. The second is what a tool labelled a standard error channel draws. The fitted line is identical either way — only the distance out to the channel lines changes — and on the short series a person types in by hand that difference is large enough to see.

Standard Deviation Channel formula

x = 0, 1, 2 … n − 1        the row index
y = the prices entered, oldest first

slope     = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)²
intercept = ȳ − slope × x̄
fitted_i  = intercept + slope × i
residual_i = y_i − fitted_i

σ = √( Σ residual² ÷ n )        population basis
  = √( Σ residual² ÷ (n − 2) )  standard error basis

upper = fitted + k × σ
lower = fitted − k × σ

R² = 1 − Σ residual² ÷ Σ(y − ȳ)²
n
How many prices were fitted, after blank rows are dropped. At least three are required: two points define a line exactly, leaving no residuals to measure.
x̄, ȳ
The mean row index and the mean price. The fitted line always passes through this pair, which is a property of least squares rather than a constraint imposed here.
σ
The residual standard deviation — how far the prices scattered from the fitted line, in price terms. The two denominators give two different figures from the identical fit.
k
How many residual standard deviations the channel lines sit either side. Two is the usual charting default; it is a convention, not a property of the series.
R²
The share of the variation in the prices entered that the straight line accounts for. It says nothing about whether a straight line is the right shape.

Least squares picks the one line that makes the sum of the squared vertical gaps as small as possible. Squaring is what makes it symmetric — a price 2 above the line and one 2 below contribute equally — and it is also what lets a single distant price dominate the fit, since a gap twice as large counts four times as much. On a short series one unusual price can visibly tilt the line, and there is no robust variant here that would discount it.

A property that follows from the fit rather than being imposed on it: the residuals always sum to exactly zero. That is why σ is a root mean square about zero rather than about an estimated mean, and it is why the fitted line passes through the mean of the prices at the mean row index. If a set of residuals from elsewhere does not sum to zero, whatever produced it was not an ordinary least squares fit.

The choice of denominator is a real disagreement between packages and it is quantified rather than hidden. Dividing by n treats the residuals as the whole population. Dividing by n − 2 pays a degree of freedom for each of the two parameters the line already spent on the same data, the slope and the intercept, which is the standard error of the estimate as a regression textbook defines it. The standard error basis is always the wider of the two, by a factor of √(n ÷ (n − 2)): on 14 prices that is √(14 ÷ 12) = 1.0801, so the channel is 8.0% wider. On the worked example below the width goes from 1.58 to 1.71 with nothing else changed.

The intercept is reported as the fitted value at the first row, because x starts at zero there. A package that indexes rows from one instead reports an intercept exactly one slope lower for the identical fit — the line is the same line and every drawn level is the same price, but the number labelled intercept differs. This is a frequent source of confusion when comparing regression output between tools, and it is why the row is labelled by what it is rather than by its name in a textbook.

R² is one minus the unexplained variation over the total variation, and it answers a narrower question than it is usually read as answering. A high figure means the prices sit close to a straight line. It does not mean a straight line is the correct shape for them, it does not mean the relationship continues past the last row, and it says nothing about whether the slope is large enough to matter. On a series where every price is identical there is no variation to explain at all, the ratio is zero divided by zero, and the statistic is reported as undefined rather than as nought or one.

Standard Deviation Channel: a worked example

The fourteen closes the calculator opens with — 100.00, 100.80, 100.40, 101.60, 102.10, 101.50, 102.90, 103.40, 103.00, 104.20, 104.80, 104.30, 105.60, 106.10 — fitted at two deviations on the population denominator, with 105.80 entered as the current price.

  1. Rows and meansn = 14, x runs 0 to 13, x̄ = 6.5, ȳ = 1,440.70 ÷ 14 = 102.907143
  2. Σ(x − x̄)²227.50
  3. Σ(x − x̄)(y − ȳ)102.55
  4. Slope102.55 ÷ 227.50 = +0.450769 per period
  5. Intercept102.907143 − 0.450769 × 6.5 = 99.977143
  6. Fitted line at the last row99.977143 + 0.450769 × 13 = 105.84
  7. Sum of squared residuals2.182901
  8. Residual σ, population basis√(2.182901 ÷ 14) = 0.3949
  9. Channel at 2 deviations105.84 ± 2 × 0.3949 = 105.05 to 106.63, a width of 1.58
  10. R²1 − 2.182901 ÷ 48.409286 = 95.49%
  11. Where 105.80 sits in the channel(105.80 − 105.0474) ÷ 1.5795 = 47.65%

A line rising 0.4508 per period that reaches 105.84 at the last row, with channel lines at 105.05 and 106.63 and the entered price sitting a little under halfway between them. Switching only the denominator to n − 2 leaves the line exactly where it is and widens σ to 0.4265, moving the channel to 104.98 and 106.69 — a width of 1.71 rather than 1.58. Adding one more price to the series would move the slope, the intercept and both channel lines, including the parts of them drawn across the earlier rows.

How to use the Standard Deviation Channel calculator

  1. Enter the prices oldest first, one per row — at least three, and up to sixty. Blank rows are ignored, so a row added and not yet typed into will not blank the result while you are filling it in.
  2. Use a consistent series. The row index is the x value, so mixing daily and weekly closes, or leaving out the rows for a quiet week, changes the slope without any warning that it has.
  3. Choose how many deviations the channel lines sit either side. Two is the usual default and a convention rather than a measurement; the Custom option accepts anything from zero to ten.
  4. Choose the denominator to match whatever you are comparing against. Population is the common charting default and what this page opens with; standard error is the textbook definition and always gives the wider channel.
  5. Read R² and the residual standard deviation together. The first says how closely the prices track a line, the second how far they scatter from it in price terms.
  6. Add a current price if you want its position between the two lines reported. It is not added to the series and does not move the fit.

Limitations of the Standard Deviation Channel calculator

Every calculation makes assumptions. These are the ones that matter here.

  • The fit is recomputed from every price in the list, so the channel moves whenever a price is added or removed. Lines drawn across earlier rows were not in those positions when those rows printed.
  • A straight line is imposed on the data rather than tested against it. A series that curved cleanly can still return a high R², because R² measures closeness to the fitted line and not whether a line was the right shape.
  • Least squares is sensitive to outliers, since each residual is squared before being summed. On a short series one unusual price can tilt the line and inflate the channel width noticeably.
  • The channel summarises dispersion that has already happened. It is not a boundary: at two deviations a well behaved series would be expected to spend some of its time outside the lines, because that is what two standard deviations means.
  • A series in which every price is the same leaves no variation for a line to account for, so R² is reported as undefined rather than as a number, and a series lying exactly on a straight line has no measurable channel width at all.

Frequently asked questions about Standard Deviation Channel

Why is my platform's channel wider than this one?

The most likely cause is the denominator. Dividing the squared residuals by n − 2 instead of n gives a wider channel by a factor of √(n ÷ (n − 2)) — about 8% on 14 points and about 2.6% on 40 — and both are in common use. The second possibility is a different tool altogether: a Raff regression channel places its lines at the distance of the furthest price from the fitted line rather than at a standard deviation, which usually gives something wider again.

Which denominator does this standard deviation channel calculator use?

Population, dividing by n, unless you switch it — that is the more common charting default. The standard error basis, dividing by n − 2, is the definition a regression textbook gives, because two degrees of freedom were already spent estimating the slope and the intercept from the same data. The fitted line is identical under both, and the result panel names which one produced the width shown.

Does a linear regression channel repaint?

Yes, in the sense that matters. Every price in the series contributes to the slope and the intercept, so adding one recalculates the entire line and both channel lines with it, including the segments drawn over the oldest rows. This is the structural difference between a channel and a pivot table: the pivot is fixed once its period closes, while the channel is only ever a description of the series as it currently stands.

What does an R² of 95% actually mean here?

That 95% of the variation in the prices entered is accounted for by the straight line, and 5% is left in the residuals. It does not mean the line continues, that a straight line is the right shape, or that the slope is large enough to be interesting — a series with very little noise can give a high R² and almost no slope, which is why the slope per period is a row of its own.

How is this different from Bollinger bands or a price channel?

Both Bollinger bands and this tool draw lines a number of standard deviations from a central line, but they measure different things. Bollinger bands take the standard deviation of the prices themselves about a moving average, so the central line bends with the prices. A regression channel takes the standard deviation of the residuals about a single straight line fitted to the whole series, so the centre is straight and the deviation measures scatter around a trend rather than around a rolling mean. A price channel calculator of the Donchian kind is different again: it places its lines at the highest high and the lowest low of a look-back window, and measures no dispersion at all.

Can I extend the channel forward past the last price?

This calculator does not do that, deliberately. It reports the fitted line and the channel at the latest row entered, which is the last point the data actually covers. Projecting the line forward would present an extrapolation as though it were a measurement, and the fit gives no information about whether the slope holds for even one more period.

Last reviewed . See our methodology and editorial policy.

More technical calculators