Rank based on Correlation with a defined Series

Hi, trying to do something that would seem like it ought to be fairly easy, but can’t find a way. I want to create a Ranking based on the correlation of the current stock to another series, for example in this case SPY. Lower is better.

Has anyone done this in P123? Thanks.

Tom C

There is no correlation function,.
Steve

I think we need a generalized correlation function - i.e. correlation between two securities or a security and the benchmark.

Does anyone else agree?

Walter

Yes - there is a feature request out there for this.
Steve

Thanks. I voted for the one requested by TDCARLSON. Since it was opened about 10 months ago, I’m not holding my breath on that feature.

Tom,

look at this formula:

(Close(0)/Close(20)-1)/(Close(0,GetSeries(“SPY”))/Close(20,GetSeries(“SPY”))-1)

In a ranking rule, it should correlate the 20-day price change of all stocks (of your universe) to the 20-day price change of SPY (I think).

Matthias

Here’s one way to do it. This uses 5 day roc ascorrelationfactor. If you want to change it to daily then edit the “5” to “1”. Limits on the loop counter value will limit the look a k you can q hiee with this approach.

Loopsum(" eval( roc(5,ctr*5)roc(5,ctr5,$spseries)>0,1,0) " , 45)