There are some other questions:

1. Is the declaration

var Correlations[NN][NN]

equal to

var Correlations[NN * NN] ?


I thought that Correlations[NN][NN] defines a 2-dimensonal variable for use as Correlations[0][0], Correlations[0][1] etc.? In the financial hacker script Correlations is defined this way but used as a 1-dimensioal variable with

Correlations[N*i+j] = Correlation(Returns[i],Returns[j],LookBack)


2. plotHeatmap()

Correlation ranges from -1 to 1 but plotHeatmap() only from 0..1, so

Code:
function main() {
	
        ...
	
	Correlations[0] = 1;
	Correlations[1] = 0;
	Correlations[2] = -0.5;
	Correlations[3] = -1;
	
	plotHeatmap("Correlation",Correlations,2,2);
}


leads to



Isn't it a bit confusing to display the whole spectrum from 0 (no correlation) to -1 (perfect negative correlation) with the same color?

Thanks, Sphin