ArrayCopyRates() - values altered in MT4

 

I have found that the variables Close[] Open[] High[] Low[] DO NOT correlate with the chart. Similarly the ArrayCopyRates() function DOES NOT correlate with the chart either.

Both appear to yeild values that appear to have been pre-averaged on approx. a 10bar period. Consequently it is also delayed.

The ArrayCopyRates() is provided for .DLL writers - this problem will deliver corrupt data - not accurate raw price data - and will prevent analytical .DLLs from working properly. Forecasting on false signals!!

Is this deliberate policy on the part of the platform creators or is it a bug?

Any advise would be most appreciated.

 

Fixed

Problem with memory leakage between software modules.

Problem fixed.

MT4 clean.

 

...

Was just starting to write you a message and than saw this message of yours

Anyway, take care at one more point when you use ArrayCopyRates() (if you plan to send it to a DLL or anything similar) It will internally raise an error if not all rates are copied, so it is safest to use something like this :

bool getRates(double rates[][6],int timeFrame,int& size)

{

int err;

for (int retries=3; retries>0; retries--)

{

size = ArrayCopyRates(rates,NULL,timeFrame);

err = GetLastError();

if (err == 0) break;

Sleep(1000);

}

return(err==0);

}

PS: frequently, when you are copying rates from other timeframes, metatrader initiates download of data and if you do not wait for that process to finish, you are going to get garbage in rates array, so it is safer to always check if everything is OK (no error raised by metatrader)

regards

mladen

stephencurrah:
Problem with memory leakage between software modules.

Problem fixed.

MT4 clean.
Reason: