S

#### Samus Aran

##### New member

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));
```