work out correlation and 1 standard deviation

 

What is the best way to work out the correlation between 2 different instrument in MQL4?

Should I load the data into an array and then draw a chart from that?

In Excel, it is easy to do this with some functions but I'm not sure if MQL4 has them


I want to work out a ratio as below and then apply all the values to give me a correlation and a standard deviation:

 

1) Formulate a mathematical formula of your problem. (Use the formulas you use in excel)

2) Write the formula in mql

3) done, if done properly you get the same results as in excel

 
Add: you probably cannot use non stationary values for a correlation calculation, but i am not a math guy
Reason: