ExMinusAveragePow2 = 0; for (int i = 0; i <Periods; i++) { ExMinusAveragePow2 += MathPow(time[i] - AverageTime,2); }
The error is in other line (because that variable is not declared), and the warning also disappears if you declare the variable with "double" type
The error is in other line (because that variable is not declared), and the warning also disappears if you declare the variable with "double" type
'ExMinusAveragePow2 - has been declared as a double - still getting the same bloody error message.
Why?
I am getting sick to the back teeth of screaming, I am getting so tired of ripping my hair out, I am sick and tired of a piece of software ignoring me. I have TOLD IT TO CONVERT TO THE CORRECT TYPE CAST.
WHY IS IT NOT DOING AS IT'S TOLD!?
I swear to God if I see what warning message one more time I am going to take and axe to this computer.
ONE.MORE.TIME. OR THIS COMPUTER WILL GET SMASHED.
'ExMinusAveragePow2 - has been declared as a double - still getting the same bloody error message.
Why?
I am getting sick to the back teeth of screaming, I am getting so tired of ripping my hair out, I am sick and tired of a piece of software ignoring me. I have TOLD IT TO CONVERT TO THE CORRECT TYPE CAST.
WHY IS IT NOT DOING AS IT'S TOLD!?
I swear to God if I see what warning message one more time I am going to take and axe to this computer.
ONE.MORE.TIME. AND WILL SCREAM SO LOUD YOU WILL BE ABLE TO HEAR ME!
time[i] = double(ulong(Time[i]));
Right, here is my revised code with your implementation:
void CalculateRSquared(int Periods, int SMAMODE){ if(Periods > 10){ Periods = 10; } //--- //// Declare dynamic arrays. double time[]; double price[]; double time_pow[]; //--- //--- //// Resize arrays to the specified number of period. ArrayResize(time, Periods); ArrayResize(price, Periods); ArrayResize(time_pow, Periods); //--- //--- //Array to store values. for (int i = 0; i < Periods; i++) { //time[i] = (double)Time[i]; time[i] = double(ulong(Time[i])); price[i] = Open[i]; time_pow[i] = MathPow(time[i], 2); } //--- //--- //Calculate Sums & Averages double SumOfPeriods = 0; for (int i = 0; i < Periods; i++){ SumOfPeriods += time[i]; } double SMA = iMA(NULL, 0, Periods, 0, SMAMODE, PRICE_OPEN, 0); double AverageTime = SumOfPeriods / Periods; //--- ExMinusAverage = 0; EyMinusAverage = 0; ExyAverage = 0; Ex2 = 0; Exy = 0; EyMinusAveragePow2 = 0; for (int i = 0; i < Periods; i++) { ExMinusAverage += (time[i] - AverageTime); EyMinusAverage += (price[i] - SMA); ExyAverage += (time[i] - AverageTime) * (price[i] - SMA); Ex2 += time_pow[i]; Exy += time[i] * price[i]; EyMinusAveragePow2 += MathPow(price[i] - SMA, 2); } ExMinusAveragePow2 = 0; for (int i = 0; i < Periods; i++){ ExMinusAveragePow2 += MathPow(time[i] - AverageTime,2); } double SRTExMinusAveragePow2 = sqrt(ExMinusAveragePow2 / (Periods - 1)); double SRTEyMinusAveragePow2 = sqrt(EyMinusAveragePow2 / (Periods - 1)); double CoVariance = ExyAverage / (Periods - 1); double Variance = (SRTExMinusAveragePow2 * SRTEyMinusAveragePow2); double CorrelationCoefficient = NormalizeDouble((CoVariance / Variance),2); double StandardDeviation = NormalizeDouble(SRTEyMinusAveragePow2 / Point,2); double RSquared = NormalizeDouble(MathPow(CorrelationCoefficient,2)*100,2); return; }
...so why am I STILL getting the same warning message...?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Right, I have the following:
Why does MQL4 have a complete hissy fit about the following line:
ExMinusAverage += (double)(time[i] - AverageTime);
When it is blatantly obvious that this s correctly typecast?
Is is so silly at times, its absolutely ridiculous.
I am so tired of having my time wasted just because MQL4 decides it's going to be a complete spoilt little child. I am so tired of this software not doing what I tell it to bloody do!