Samus Aran
New member
hey everyone, I'm trying to make my own Correlation indicator with just adding as a modification the Mean & Percentile from the original indicator that ThinkorSwim provided . I got the mean to work, but I'm having trouble with the Percentile. I don't want the Percentile to be display on the graph; I want it display on the title of the indicator above its window, so I can get just coefficient Percentile of this instrument and compare the Percentile coefficient with other instruments.
sincerely
sincerely
Code:
declare lower;
input length = 2000;
input correlationWithSecurity = "SPY";
plot Correlation = Correlation(close, close(correlationWithSecurity), length);
Correlation.SetDefaultColor(GetColor(5));
plot ratioAvg = ExpAverage(Correlation, length);
plot center = 0;
def currentCorrelation = Correlation(BarNumber(), close, length);
CorrelationPercentile = AsPercent((currentCorrelation / length));