Need Guidance on Rsquare Indicator

madeinnyc

madeinnyc

Member
I attempted to do this myself in an effort to learn Thinkscript. But after unsuccessfully trying, I'm posting here for guidance on how best to do the following:

This R-Square Indicator was found on TOS. I'm trying to make it into an upper study where def r = (exponential or hull MA), not WMA, with all else being the same.

I tried: delcare upper; but the chart looked funny afterward (20 tick chart on /NQM20). Not sure what I'm doing wrong, but would love your help in learning how to do this right!

declare lower;

input length = 14;
input rAverageLength = 1;

def r = (WMA(close, length) - Average(close, length)) * (length + 1) /
(StDev(close, length) * Sqrt((Sqr(length) - 1) / 3));

plot RSq = Sqr(Average(r, rAverageLength));
RSq.SetDefaultColor(GetColor(8));
 
Last edited:

Similar threads

Top