Importing Restriction

 

Hello all,

I'm a software engineer with a C++ background and have been using metatrader for a long time.

I've been importing chart data into custom symbols successfully however, I lately have been needing to import historic prices; and in this area, MT5 is limited.

The issue --seems to-- lie in the use of Unix time where it starts at 0 seconds from 01 Jan 1970. MT5 --seems-- to be using this way of representing time, and whilst not uncommon, this poses an issue when it comes to importing historic data prior to those dates.

I have a file I'm trying to import (attached) and this won't import as a result of this. While I can fudge the dates so that they are after 1971 (it turns out MT5 does not like 1970 either), I prefer not to.


Anyone has come across this issue please or can recommend any other suggestions other than changing dates and times? Unless I'm missing something here, and maybe there is something wrong in my file, I'm really not sure how to proceed with MT5.

Attached are my files:

1969-2024-to-mt5-1970Bug.csv: Has the last two rows with dates on or before 1970. This will not import.

1969-2024-to-mt5-BugFix.csv: Has the last two rows with dates corrected to be after 1971. This will import; alas, I don't want to fudge dates.


Any suggestions would be appreciated or perhaps a contact liason?


Thanks!

Happy New Year!

 
Hello,
To my knowledge unix timestamp is implementation-specific to the underlying platform or programming language. datetime type in MQL is 64-bit signed number of seconds since Thursday 1 January 1970 00:00:00. Unfortunately, in MQL the datetime type cannot contain or encode negative number of seconds to represent dates before 1970. (considered to be invalid datetime in MQL)

Alternative:
Unix time is not the only standard for time that counts away from an epoch. On Windows, the FILETIME type stores time as a count of 100-nanosecond intervals that have elapsed since 0:00 GMT on 1 January 1601. But, then you have to use Windows API functions, instead and then it is also not possible to import these old dates into custom symbols.

 
amrali #:
Hello,
To my knowledge unix timestamp is implementation-specific to the underlying platform or programming language. datetime type in MQL is 64-bit signed number of seconds since Thursday 1 January 1970 00:00:00. Unfortunately, in MQL the datetime type cannot contain or encode negative number of seconds to represent dates before 1970. (considered to be invalid datetime in MQL)

Alternative:
Unix time is not the only standard for time that counts away from an epoch. On Windows, the FILETIME type stores time as a count of 100-nanosecond intervals that have elapsed since 0:00 GMT on 1 January 1601. But, then you have to use Windows API functions, instead and then it is also not possible to import these old dates into custom symbols.

Hi there,

Thanks for your reply. Yes, Unix timestamp is implementation specific based on the compiler used. My question really is not about MQL or the Windows API but rather more on what Metatrader does or can do to fix this issue? As a trader, I want to be able to import historic prices accurately; hence my question.

Thanks for following up with me on this though!

Regards,
Duncan

 
dnc77 #:
it is also not possible to import these old dates into custom symbols

Thanks