Indicators: Correlation Coefficient

 

Correlation Coefficient:

Correlation Coefficient" indicator

Correlation Coefficient

Author: Artyom Trishkin

 
//--- correlation coefficient calculation
   double array_a[];
   double array_b[];
   vector a;
   vector b;

   for(int i=limit; i>=0; i--)
     {
      int count=ExtPeriod;
      if(limit>1 && i+count>limit)
         count=limit-i+1;

      if(ArrayCopy(array_a,ExtBufferMA1,0,i,count)!=count || ArrayCopy(array_b,ExtBufferMA2,0,i,count)!=count)
         continue;
      a.Swap(array_a);
      b.Swap(array_b);
      ExtBufferCorrelation[i]=a.CorrCoef(b);
     }
It's very expensive.
 
fxsaber #:
It's very expensive.

I guess. The goal was not to make a rocket. The goal was logical simplicity.

Can you show me your options? Simple and straightforward. I'd be happy to explore.

 
Artyom Trishkin #:

Can you show me your options?

I don't have any. Just seen iterative implementations.

 
fxsaber #:

I don't have any. Just seen iterative implementations.

I see. I didn't bother for the sake of simplicity
 

I can't understand what the reason is
If you run the indicator on the visual test on the gold futures and compare it with XAUUSD, the indicator line and calculations in the robot are normal.

But if after the test to look at the chart that is displayed according to the results of testing or throw the indicator with the test parameters separately, then these lines are not clear on what criteria make their calculations.

Visual testing


And this appears after the test, the same thing happens if you add an indicator separately.


What can be the problem ?