Skip to content
All library documents

OLS Regression Channels with Confidence and Prediction Bands

Article MQL5 articles

Summary

The article derives rolling linear regression channels from ordinary least squares fitted to closing prices. It distinguishes confidence intervals, which quantify uncertainty about the estimated mean trend, from prediction intervals, which also include the scatter expected for an individual observation. Both use Student’s t critical values and account for residual variance and the evaluation point’s leverage. The article also explains why bands widen toward the edges of the fitted window and why a one-step-ahead forecast at the next bar differs from an interval evaluated at the latest bar already used in the fit.

It contrasts these model-based intervals with Donchian channels and Bollinger Bands, whose widths come from extrema or a fixed standard-deviation multiplier rather than an explicit coverage model. The worked formulas and indicator design provide a statistical basis for constructing the bands, but nominal coverage depends on OLS assumptions such as independent, stable residuals. The text acknowledges that financial price data often violate those assumptions and says empirical calibration and out-of-sample coverage checks are needed before treating the bands as probabilistic signals.

Key ideas

  • OLS regression estimates a trend line and residual variance from a rolling window of closing prices.
  • Confidence intervals measure uncertainty in the fitted mean, while prediction intervals include individual observation noise.
  • Student’s t critical values reflect the residual degrees of freedom and are especially relevant for smaller samples.
  • Leverage makes interval bands wider away from the center of the regression window.
  • A one-step-ahead interval is an extrapolation and must be distinguished from an interval at the latest in-sample bar.
  • Nominal coverage depends on model assumptions that financial time series may violate, so empirical validation is necessary.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.