Zorro's Spearman returns high values when input series is steadily decreasing and low values when input series is steadily increasing. Someone implemented it backwards. I think it's because series index is in reverse order.

The correct implementation is something like
Code:
var d = ((Period - Idx[g_count] - 1) - g_count);
sum += d * d;