Skip to content
All library documents

Reading Trend and Choppiness with Timeframe-Segmented Regression

Article TradingView scripts

Summary

This indicator fits a straight line over each interval defined by a user-selected timeframe and plots the resulting segments on a lower-timeframe chart. It estimates each segment’s endpoints from weighted and simple moving-average calculations, then measures the residual root mean squared error to form optional upper and lower channel boundaries. The user can choose the input series, interval, channel-width multiplier, and whether to show the extremities.

The accompanying guidance interprets slope and channel width together: a pronounced slope with a narrow channel suggests a cleaner directional move, while a broad channel around a flat line can indicate opposing swings that a linear fit represents poorly. A flat, narrow channel is described as low-amplitude, trendless movement. These are qualitative reading heuristics rather than tested trading rules. The timeframe should exceed the chart timeframe, and the document warns that very large intervals may error; line-count limits also reduce how much history is visible when channels are enabled.

Key ideas

  • The indicator draws a separate linear regression segment for each interval in a selected timeframe.
  • Residual error around each fitted line sets the width of optional upper and lower boundaries.
  • Slope and channel width together provide qualitative clues about directional strength and within-interval variability.
  • A flat line with a wide channel can signal that a linear model poorly summarizes the interval.
  • The guidance is interpretive rather than a validated strategy, and plotting limits constrain visible history.

Tags

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