Here is the response from the Support Team, no acknowledgement of the bug, and tell me to go learn about doubles! ( not sure why I bothered....)
From Support Team:
Being serious . . . why do you need to explicitly type cast a double, the array is a double ? to a double ? I guess it's because the array isn't actually a double array but some kind of pointer/redirect to the actual history data and that returns a datetime.
Perhaps the ideal solution to this kind of issue would be to cover this kind of anomaly in the documentation . . . assuming it can't be fixed to work as expected.
2013.09.18 20:48:36 arraycopyrates test EURUSD,M1: Alert: d1 - d2 = 60 //calculation works fine when values are copied out of the array into integers.
2013.09.18 20:48:36 arraycopyrates test EURUSD,M1: Alert: array[0][0] - array[0][1] = 0 //calculation directly on array values returns zero as reported by ydrol
2013.09.18 20:48:36 arraycopyrates test EURUSD,M1: Alert: array[1][0] = 1379566020 2013.09.18 20:48:36 arraycopyrates test EURUSD,M1: Alert: array[0][0] = 1379566080 // array does contain correct values
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
OK, maybe not typecasting . . . maybe a memory issue.
Agree. Because the ACR data structure is a bit of a fudge (making datetime look like doubles), I think the MQL expression parser is getting confused.
Agree. Because the ACR data structure is a bit of a fudge (making datetime look like doubles), I think the MQL expression parser is getting confused.
Anyway it's a bug. Did you report it to the Service Desk ?
Nope, I have a workaround :) I will next time I find myself logging onto mql5 site..
EDIT: Reported now !
Here is the response from the Support Team, no acknowledgement of the bug, and tell me to go learn about doubles! ( not sure why I bothered....)
From Support Team:
Here is the response from the Support Team, no acknowledgement of the bug, and tell me to go learn about doubles! ( not sure why I bothered....)
From Support Team:
Here is the response from the Support Team, no acknowledgement of the bug, and tell me to go learn about doubles! ( not sure why I bothered....)
From Support Team:
Perhaps the ideal solution to this kind of issue would be to cover this kind of anomaly in the documentation . . . assuming it can't be fixed to work as expected.
Thats a strange bug, you shouldnt even need to typecast datetimes to perform calculations on them. Is it bad practice to treat datetimes as integers ?
output:
2013.09.18 20:18:18 test EURUSD,M1: Alert: Time[0] - Time[1] = 60
2013.09.18 20:18:18 test EURUSD,M1: Alert: Time[1] = 1379564220
2013.09.18 20:18:18 test EURUSD,M1: Alert: Time[0] = 1379564280
Now an ArrayCopyRates test
output:
2013.09.18 20:48:36 arraycopyrates test EURUSD,M1: Alert: d1 - d2 = 60 //calculation works fine when values are copied out of the array into integers.
2013.09.18 20:48:36 arraycopyrates test EURUSD,M1: Alert: array[0][0] - array[0][1] = 0 //calculation directly on array values returns zero as reported by ydrol
2013.09.18 20:48:36 arraycopyrates test EURUSD,M1: Alert: array[1][0] = 1379566020
2013.09.18 20:48:36 arraycopyrates test EURUSD,M1: Alert: array[0][0] = 1379566080 // array does contain correct values