What is an R-squared trend fit?
An R-squared trend fit measures trend strength by running a linear regression of price against time over a lookback window and reporting R-squared, the fraction of price variance explained by the fitted line. The output runs from 0 to 1: near 1 means price moved almost exactly along a straight line through the window, near 0 means the line explains essentially nothing and the window was noise or range. Because the square discards the line's sign, R-squared is pure strength; direction comes from the regression slope, checked separately.
The construction borrows directly from statistics, and that lineage is its main appeal. R-squared has known sampling behavior, so instead of an arbitrary threshold a trader can ask whether the fit is statistically distinguishable from random data for the window length used. Published critical values exist for common lookbacks: shorter windows need higher R-squared before the trend reading means anything, longer windows clear significance at lower values. This puts trend-versus-no-trend on firmer footing than eyeballing a slope.
R-squared is the unsigned square of the Correlation Trend Indicator computed over the same window, and it is the same statistic that underlies the confidence one should place in an LSMA or a linear regression channel: a channel drawn through a low R-squared window is a line through noise, however clean it looks.
How it's calculated
R-squared is the squared Pearson correlation between the source series and the bar index over the lookback:
Both forms are algebraically identical for a simple regression on time.
Some traders regress the logarithm of price instead, which makes fits comparable across large percentage moves.
Direction is not in the output; pair R-squared with the sign of the regression slope.
How traders use it
- As a trend/no-trend gate: enable trend-following rules only when R-squared exceeds the critical value for the chosen window, and treat low readings as range conditions where mean-reversion logic applies.
- Combined with slope into a two-factor signal: rising slope with high R-squared qualifies a clean uptrend, while high slope with poor R-squared flags a jumpy, gap-driven move that trend entries handle badly.
- As a quality check before trusting regression-derived tools such as the standard error channel; channel projections mean little when the underlying fit explains a small share of variance.
- Falling R-squared after an extended trend is watched as an early sign of trend maturity, often before price violates any level. It is a decay symptom, not a reversal signal, and chop can persist long after the reading drops.
R-squared trend fit vs other strength measures
Correlation Trend Indicator: CTI is the signed square root of the same statistic: one bounded series carrying both direction and strength. R-squared isolates strength and leans on the slope for direction.
ADX/DMI system: ADX accumulates smoothed directional movement and reacts slowly at both ends of a trend. R-squared is a direct windowed fit with a statistical interpretation and a hard 0-to-1 scale.
Choppiness Index: The Choppiness Index infers trendiness from how range compounds across the window, without fitting any line. R-squared asks specifically about linear fit, so the two can disagree on curved but directional moves.
Vertical Horizontal Filter: The VHF compares net range to the sum of bar-to-bar movement, a path-efficiency idea. R-squared measures how well a straight line explains the path, penalizing even efficient moves that bend.
Concept family
Trend
100 concepts mapped · 100 in the Library
R-squared Trend Fit FAQ
What is a good R-squared threshold?
It depends on the window, because short windows produce high R-squared by chance. Statistical tables give the cutoff for each length; for lookbacks near 14 to 20 bars, values below roughly 0.2 to 0.3 are generally indistinguishable from noise.
Does high R-squared mean the trend will continue?
No. It certifies that the last n bars fit a line well. Strong fits often persist for a while, but the statistic is descriptive of the past window and mature trends can show their highest readings just before stalling.
How is this different from just using the regression slope?
Slope measures steepness in price units and says nothing about fit quality; a gap-and-chop window can show a steep slope with terrible fit. R-squared measures fit quality and says nothing about steepness. Most uses need both.
Should I compute it on price or log price?
For short windows it rarely matters. Over long windows or large percentage moves, log price makes constant-percentage growth look linear, which is usually the more meaningful notion of trend.
Build R-squared Trend Fit your way.
Quant writes, tests, and refines it with you — then it runs on LuxAlgo charting or ports to TradingView.