Standard Error Bands
By LuxAlgoApr 13, 2020
The Standard Error Bands fit a linear regression line to price over a lookback window and frame it with bands offset above and below by a multiple of the standard error of the regression estimate. The standard error measures scatter around the fitted trend, not a flat average, so the bands tighten when price hugs its trend and widen when the fit degrades: width reads as trend quality. This build is a standard implementation of Jon Andersen's original formulation with the classic defaults: a 21-bar regression, bands at plus and minus 2 standard errors, and 3-period smoothing. The smoothed midline plots as the Basis between the Upper Band and Lower Band, all three refitting as new bars arrive.
How to Trade the Standard Error Bands?
- Tight bands around a sloping Basis: an orderly trend to trade with the slope.
- Widening bands: the trend is losing definition. Tighten risk or stand aside.
- Close beyond either band: an overextension past what the fitted trend allows, prone to revert toward the Basis, or the first sign of a turn, so confirm.
- Pullbacks to the Basis: in a clean trend, dips to the midline offer continuation entries near the trend's center.
Standard Error Bands Settings
- Length (default 21): bars used to fit the regression and compute its standard error; longer for broader trends, shorter for recent swings.
- SE Multiplier (default 2): the standard-error multiple offsetting the bands; higher flags only larger dislocations, lower flags more often.
- Smoothing (default 3): the SMA applied to the regression line and both bands before plotting; 1 plots the raw fit.
- Source (default close): the price series the regression is fitted to.
Alerts
Two alert conditions (Cross Above Upper Band and Cross Below Lower Band) fire when the close crosses the named band.
Frequently Asked Questions
The Library is free. Quant makes it yours.
Pull any concept or indicator into Quant: rebuild it, retune it, or turn it into a backtested strategy of your own.

