- Standard Deviation Channel plots a linear regression line through price data with parallel bands at a specified number of standard deviations of re...
- **Similar:** [BBands](../bbands/bbands.md), [RegChannel](../regchannel/regchannel.md) | **Complementary:** LinReg slope for trend direction | **Trading note:** Standard deviation channel around linear regression; tighter than Bollinger for trending markets.
Standard Deviation Channel plots a linear regression line through price data with parallel bands at a specified number of standard deviations of residuals above and below. Unlike Bollinger Bands which measure deviation from a moving average, SDCHANNEL measures deviation from the best-fit trend line, capturing how much price wanders from its underlying trajectory rather than from its simple average. The algorithm is identical to REGCHANNEL; the distinction is purely a naming convention found across different platforms and literature.
Linear regression channels emerged from statistical methods applied to financial markets in the 1980s and 1990s. Gilbert Raff popularized "Raff Regression Channels" which use the same principle: fit a least-squares line to a price window and draw parallel bands at the residual standard deviation distance.
The critical distinction from moving average bands: a regression line projects the trend direction, not the average level. The residuals (actual minus predicted prices) measure how much price deviates from this directional fit. When residuals are small, price is tracking the trend cleanly. When residuals grow, the trend is becoming noisy or price is breaking away from its recent trajectory.
Some platforms label this indicator "Standard Deviation Channel" (emphasizing the band-width metric), while others use "Regression Channel" (emphasizing the centerline method). Both SDCHANNEL and REGCHANNEL implement identical OLS regression with population standard deviation.
For each point in the window, the residual is the difference between the actual and predicted value. The population standard deviation of these residuals:
where $k$ is the multiplier (default 2.0). Under normality assumptions, $k = 2$ captures approximately 95% of residuals.
### 4. Residual Properties
By definition of least squares: (1) the sum of residuals equals zero, (2) residuals are uncorrelated with the $x$ values, and (3) when $\sigma = 0$, all points lie exactly on the regression line.
### 5. Complexity
Per bar: $O(n)$ due to two passes over the window (sums, then residuals). Memory: a ring buffer of $n$ doubles. The index sums $\sum x$ and $\sum x^2$ are precomputed constants for fixed $n$.