1996issue C091-6
Constructing a standard-error envelope around a linear regression
A 21-period linear regression of closes sets the envelope center, and standard error of the estimate sets the width. Building that residual first shows why a tight mean-centered envelope is not the same object as a tight regression-centered envelope.
- The envelope center is the last point of a 21-period linear regression of closes, and the outer lines sit two standard errors of the estimate above and below that point.
- Both the regression end-value and the standard-error width are then smoothed with a three-period simple average so a single large close does not reprice the whole envelope.
- The comparison construction uses a 20-period moving average of closes plus and minus two standard deviations, so its width tracks volatility around mean price rather than around a fitted line.
- Percent A locates the close between the standard-error lines, while a tightness screen and a Fibonacci composite of 8-, 13-, and 21-period lookbacks are companion reads of the same workflow.
What the envelope is centered on
This article reconstructs a historical workflow for a three-line envelope centered on a linear regression of closes. A second envelope, centered on a moving average, is built beside it so residual width around a fitted line can be compared with volatility around mean price.
Linear regression, in this construction, is a least-squares line through a fixed lookback of ordered closes. It is used as the moving center of the envelope and as the baseline for residual width. The regression line is a least-squares fit drawn through the center of the lookback so observations sit with equal distance above and below the line.
The independent axis for the fit is a sequential bar index rather than calendar dates, so a weekend gap is not counted as multiple periods.
How the outer lines are set
The envelope center is the last point of a 21-period linear regression of closes, and the outer lines sit two standard errors of the estimate above and below that point.
Standard error of the estimate is the residual scatter of closes around the fitted regression line. It is the width term of the envelope. It is zero when every close equals that bar's regression value and rises as noise around the line increases.
Both the regression end-value and the standard-error width are then smoothed with a three-period simple average so a single large close does not reprice the whole envelope.
A mean-centered comparison
Bollinger bands are a three-line envelope whose middle line is a moving average of closes and whose outer lines sit a fixed number of standard deviations away, measuring volatility around mean price.
The comparison construction uses a 20-period moving average of closes plus and minus two standard deviations, so its width tracks volatility around mean price rather than around a fitted line.
A tightness screen divides a 55-period average true range by the width of the 21-period mean-centered bands and treats a reading of 50 percent or more as a compressed-volatility condition. That screen is a reading of mean-centered width, not of scatter around the fitted line.
Companion reads of location and stacked lookbacks
Percent A is the scaled location of the close between the lower and upper standard-error lines, with 100 at the upper line and 0 at the lower line. The companion oscillator equals 100 when the close is on the upper band and 0 when it is on the lower band. It is computed as the close minus the lower band, divided by band width, times 100.
Fibonacci retracement is used here as stacked lookbacks so 8-, 13-, and 21-period calculations can be averaged into one composite path. A Fibonacci composite averages the 8-, 13-, and 21-period versions of the same series so the shortest window leads, the middle window lags, and the longest window mutes one-bar shocks.
The coefficient of determination is the share of squared error removed by using the regression as predictor instead of the sample mean. When that Fibonacci-composite coefficient of determination is below 15, all three lookbacks are read as jointly at extreme lows.
All readings on this track · 45 readings
- 1992Constructing volatility-scaled bands with relative strength index confirmation
- 1994Implied volatility as a band-defined regime filter for index options
- 1995Constructing projection bands from least-squares slopes
- 1995Constructing regression projection bands and range oscillators
- 1996Constructing Bollinger bands, percent-b, and stochastics
- 1996Constructing mechanical rules from Bollinger Bands and stochastics
- 1996Constructing a standard-error envelope around a linear regression
- 1996Dual-horizon ratio envelopes and regression error channels
- 1997Rational group structure with a trend screen, RSI, and bands
- 1997Asymmetric volatility band construction
- 1998Constructing three-state filters from Bollinger band envelopes
- 1999Combination filters with Bollinger Bands and the relative strength index
- 1999Constructing stochastic timed exits and band-RSI reversals
- 1999Evaluating Bollinger Bands against fixed-width and range-based envelopes
- 2000Constructing a Bollinger Band target as a forward price
- 2001Numeric candlestick encoding with local size bands
- 2001Ranked candlestick sentiment to band-cross entries
- 2002Combining Bollinger Bands, RSI, and a stop-loss
- 2002Bollinger Bands remain filters, not forecasts
- 2002Constructing a stochastic RSI with Bollinger bands
- 2002Constructing a StochRSI and Bollinger mechanical system
- 2003Constructing volatility-scaled Bollinger envelopes
- 2003Why tick breadth fails as a market personality
- 2005Constructing Bollinger bands versus fixed trading bands
- 2006Squared versus absolute deviation in envelope construction
- 2006Confirming yen crossovers with implied volatility and bands
- 2006A daily candle reversal is a hypothesis until shorter sessions fail at the same zone
- 2008Rebuild the Relative Strength Index as price-scale bands
- 2008Reading Relative Strength Index extremes on one price axis with Bollinger Bands and moving averages
- 2011Three-filter confirmation for short-swing futures
- 2011Constructing an inverse Fisher stochastic with bands and averages
- 2012Constructing a Bollinger Band indicator suite
- 2012Stacking price extremes, crossovers, bands, and MACD
- 2012Adaptive Bollinger band impulse, trend, and momentum filters
- 2013Rescaling stochastic, percent-B, and wave-count parameters
- 2014Industry-group quartile pivots as a Bollinger Bands case study
- 2014Bollinger Bands as adaptive price envelopes: a 2014 classroom case
- 2016Trend-channel entry rules from stacked moving averages
- 2016A permission stack for Bollinger, RSI, and the 50-period average
- 2017Constructing weighted Bollinger bands and volume averages
- 2017Four swing-entry rules that share a timed exit
- 2017Two-wave monthly cycles as a regime filter
- 2019Constructing exponential-deviation-bands from a midline-average
- 2020Critiquing exponential variants of Bollinger Bands
- 2020Constructing selectable volatility and moving-average bands