Cumulative Linear Regression Across Available Price History
Summary
This indicator fits a straight-line least-squares regression to the selected price source across the available chart history. It calculates the slope and intercept from cumulative sums of the time index and price, then plots the fitted line from the earliest included bar to the current bar. The displayed statistics also include Pearson correlation and its square, the coefficient of determination, which describe linear association and fit over that same sample.
The implementation limits the plotted start point to the most recent 5,000 bars when the chart contains more data, and the accompanying description notes display issues on some intraday timeframes and when history is extensive. The indicator is descriptive: a whole-history fit is sensitive to the chosen start and end points and can conceal changing regimes. It does not define trading signals or demonstrate predictive performance, so the line and fit statistics alone do not establish a tradable edge.
Key ideas
- The indicator fits a least-squares line to the selected price series using cumulative sums over chart history.
- The slope and intercept define the fitted line, while Pearson correlation and its square summarize linear association and fit.
- When the available history exceeds the plotting limit, the displayed line begins within the most recent 5,000 bars.
- The author notes rendering limitations on some intraday charts and charts with extensive history.
- A full-history fit is descriptive and does not by itself show predictive power or a trading edge.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.