The R-Squared (R2) is a technical indicator, which measures how closely a data set fits to the linear regression trendline. When used as a chart study, its values represent the correlation between real data points (close prices) and corresponding linear regression trendline points. In mathematical terms, R-Squared is equal to the square of the Pearson correlation coefficient. For optimization purposes, values of the coefficient may also be smoothed by a simple moving average.   

R-Squared values range from 0.0 to 1.0; higher values signify the higher extent of correlation, while those close to 0.0 indicate absence of such correlation.

Input Parameters

Parameter Description
length The number of bars used in the calculation of the linear regression trendline.
r average length

The length of the moving average to be used when optimization is required. 


Plot Description
RSq The R-Squared plot.


*For illustrative purposes only. Not a recommendation of a specific security or investment strategy.

  Past performance is no guarantee of future performance.

You may also like
The Momentum Percent Diff is a momentum-based technical indicator. Unlike the regular Momentum ...
thinkScript®: Q&A
What is thinkScript®? thinkScript® is a built-in programming language that gives you the ...
The Slow Relative Strength Index is a version of the classic Relative Strength Index (RSI), ...