Common for all ...

Attached is an example indicator using correlations library made for this purpose.

_______________________________

Parameters :Symbols-> Symbol(s) correlations to current symbol you want to be calculatedLength-> length of the correlation interval to use for computation

Price-> price to use (standard metatrader prices are :0 - closeType:1 - open

2 - high

3 - low

4 - median (high+low)/2

5 - typical (high+low+close)/3

6 - weighted (high+low+close+close)/4

0 -> Pearson (linear) correlationSubType:1 -> Kendall's tau0 -> the correlation itself1 -> fisher transform of the correlation

2 -> Student's tSubType:2 -> Spearman's rank correlation0 -> the tau itself1 -> fisher transform of the tau

2 -> Student's t

3 -> Kendall's tau as No of deviationsSubType:0 -> the rank itself1 -> fisher transform of the rank

2 -> Student's t

3 -> square of differences of ranks

4 -> expectation of differences of ranks

5 -> deviations of differences ranks

colorFrom-> starting color for gradient when used on multiple symbols

colorMiddle-> middle color for gradient when used on multiple symbols

colorTo-> ending color for gradient when used on multiple symbols

linesWidth-> width of the line used to draw

_______________________________

As you can see, common sub-types for all are the first 3 :0 -> is the correlation itself1 -> is the fisher transform as a measure of significance (more details here : Fisher transformation - Wikipedia, the free encyclopedia )

2 -> Student's t for a correlation (more details here : Student's t-distribution - Wikipedia, the free encyclopedia )

This indicator needs to have dll imports enabled and it also needs the correlations.dll from the correlations.zip file extracted to experts/libraries folder of your metatrader folder

Updated version of the indicator (not the dll, the dll stays the same) posted here : https://www.mql5.com/en/forum/180028

**Files:**

Quite some time ago I was doing some work on Pearson correlation indicator. It was working OK and I thought that the "story", as far as coding is concerned, is finished. There is Pearson, there is Spearman's rank correlations...

Ops, lets go back a bit :

Reading about correlations it struck me that Pearson correlation and Spearman's rank correlation are constantly compared. First thought was : "Why in the hell are they comparing those when the have so little in common?". Oh well, As usual, first reaction was wrong. The problem needed to be solved and the "mystery" needs to be clarified. So here we go :

First a statement : Spearman's rank correlation that usually is used on metatrader platform is just one special case of Spearman's rank correlation, and due to its cause of being special, it can not even be called a correlation. It comes from a fact that it is a case when the "counter part" used for correlation is of a constant rank and is because of that removed from the equitation : when using time as a second array in "correlations" calculation, time always has a constant rank (since it always has unequal values (unequal by same value - the change in time) in ascending order) and because of that can be removed from calculation - so it is a "correlation" of price and its times

__________________________________

Now that is the conclusion that comes before the end : I decided to clarify the whole mambo jumbo about correlations and to add what normally is used in statistics for correlations interpretation and usage in trading. Here we will have 3 prevailing correlations methods covered and solved :