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.

You may also like
The Momentum Percent Diff is a momentum-based technical indicator. Unlike the regular Momentum ...
The Slow Relative Strength Index is a version of the classic Relative Strength Index (RSI), ...
The Four-Day Breakout LE strategy is designed by Ken Calhoun. The strategy adds a buy to ...