Skip to content
All library documents

Responsive Linear Regression Channels Across Chart Timeframes

Article TradingView scripts

Summary

This indicator draws a linear trend over a configurable lookback and surrounds it with deviation channels. A smart-period option adjusts the window to the chart timeframe, using day or week boundaries for many intraday settings; users can instead choose a fixed bar count. The channel width can use root mean squared regression error, which measures departures from the fitted line, or the period’s standard deviation around its average. Configurable full and half deviation levels let users inspect price dispersion, while labels show period highs and lows and provide correlation and R-squared statistics.

The script is a charting and descriptive tool, not a complete entry or exit strategy, and it reports no trading performance. Its own caveats include greater noise and slower calculations with more data, sensitivity to session and extended-hours data, and inaccurate results for some unusually large price observations. It also notes that futures session boundaries are not fully handled and that replay can stall in some conditions. The displayed fit and bands depend on source, lookback, resolution, and data availability.

Key ideas

  • A timeframe-responsive lookback can align regression windows with day or week periods, or use a fixed bar count.
  • The indicator plots a fitted linear trend with bands based on regression error or standard deviation.
  • Correlation, R-squared, period highs, and period lows provide descriptive context for the plotted window.
  • Session choices, data availability, chart resolution, and extreme observations can affect the calculations.
  • The channels describe price behavior but do not establish a tested trading strategy.

Tags

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