If you compare the result produced by the correlation matrix
code with that produced by excel for an identical data set
I get quite different results. For the 50 days up to and
including 3/25/11 the program gives a correlation of -0.76
between ARMH and MZZ. Other methods give -0.55
Size:
Color:
Try using the
CorrelationXL DataSeries to match the Excel numbers. The script's author uses Pearson correlation series i.e. Correlation.Series. CorrelationXL.Series is a drop-in replacement.
The source code for the correlation indicator/method is available for download from the
Wiki.
Size:
Color:
As I debug the problem, it seems to be that the problem is not in the
correlation code per se, but the DataSeries LNRet. If i remove this, and replace
it with Math.Log(C1[bar]/C1[bar-1]) where C1 is the DataSeries of Close's, I
get the right answer
Size:
Color:
The LNRet DataSeries was originally created by Dr.Koch and used by such bright minds as gbeltrame during the WL4 times. The WL5/6 translation to C# produces results identic with the original WL4 version (
found here).
Size:
Color: