Log in

Mathematical functions in MQ4

Calcul of the Integral (very important)

double Integrate (double &x[], double &y[], int ind)

{

double sum = 0;

for (int i = 0; i < ind -1; i++)

sum+= (x[i+1]-x[i]) * (y[i+1]+y[i]) *0.5;

return(sum);

}

 

 

Comments

  • jaguar1637 4266 days ago

    Variance


    double Variance(double& Data[], int Per)
    {
    double sum, ssum;

    for (int i=0; i<Per; i++)
    {
    sum += Data[i];
    ssum += MathPow(Data[i],2);
    }
    return((ssum*Per - sum*sum)/(Per*(Per-1)));
    }