Skip to content
All library documents

Building a Percentage-Offset Linear Regression Channel

Article ProRealCode

Summary

The document describes a linear regression channel with upper and lower boundaries set at a percentage distance from its center line. The center is derived from a regression and slope calculation applied to a price series adjusted using the detrended price oscillator. A flag condition initializes the regression parameters; subsequent bars advance the center line, and the two channel bounds are calculated as percentage offsets from it. The example parameters specify a lookback length of 100 and an offset of 0.002.

The author presents the indicator as a way to expose channel values for screeners or automated strategies when the platform’s built-in version does not make those values available. The main caveat is that the channel moves as candles close: a channel value viewed later for an earlier point can differ from what was shown at that point in real time. The document offers code and an explanation, but no backtest, market-specific evaluation, or evidence that the channel predicts price movements.

Key ideas

  • The channel center is based on a linear regression and slope applied to a price series adjusted with the detrended price oscillator.
  • Upper and lower boundaries are calculated as percentage offsets from the center line.
  • The channel can provide values for screeners or automated strategies where the built-in indicator does not expose them.
  • Because the channel updates at candle close, historical values may differ from the values seen in real time.

Tags

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