Indicators: Pearson coefficient

 

Pearson coefficient:

Pearson coefficient

Pearson coefficient

Author: Mladen Rakic

 

Hi, thanks, for this interesting indicator!!!

Can you explain "Level up", "Middle level" and  "Level down" ? 

Thanks,

 
The complexity of this algorithm is O(n^2). See similar indicators that calculate the same values, but much faster - O(n).
 
fxsaber #:
The complexity of this algorithm is O(n^2). See similar indicators that calculate the same values, but much faster - O(n).

I agree that the code posted can be optimized

  • the code, as is, was a sort of "by the book" code so that everybody can check if the formula used is correct
  • I am sort of avoiding posting optimized code since then I get comments like : "It is too complicated code" (the hell : I even got comments that variable names must not be named as I do in my code)

Also, I am aware of the O(n) algorithm but I am not using it (for the same reason I am not using the O(n) algorithm for standard deviation) - it can be, in some cases, wildly inaccurate

Instead I am using different methods for optimized calculation. Attaching an ex5 file (even though I know it shall be deleted)

  • it gets the same results as the "official" version
  • it is optimized the "alternative" way
  • it has an additional option to display execution times (in microseconds) - for checking purpose
    • average execution time (using defaults) on my PC for initial 10K bars is 5-600 microseconds (new ticks execution times are negligible)

PS: apart from posting ex5 file, the file is not limited in any way and is not displaying any advertisement (unlike some new entries in the code base)

<ex5 file deleted>