Wrong Datetime interval being downloaded

 

Hi, I have a script that downloads market data using the Bars() CopyRates() functions, the start and end time are converted from a string to datetime, so for example if I want to download market data from 2020 until 2023 I will write something like this: "2020.01.01 00:00" "2023.01.01 00:00" and convert it to a datetime using the MQL5 provided function. However, the data that gets downloaded has a wrong interval (from 2020.11.02 until 2023.03.01)

Any ideas why this may be happening? Thanks!

 

Please share the code that specifically does this one task.    Then we can see what you are doing.

Datetime is a class. so you can look at the format of the data and reproduce it exactly in a string.  Then convert it to a datetime. 

Datetime Type - Integer Types - Data Types - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5


Hope this is helpful.

Chris

Documentation on MQL5: Language Basics / Data Types / Integer Types / Datetime Type
Documentation on MQL5: Language Basics / Data Types / Integer Types / Datetime Type
  • www.mql5.com
Datetime Type - Integer Types - Data Types - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
It se
Chris Pinter #:

Please share the code that specifically does this one task.    Then we can see what you are doing.

Datetime is a class. so you can look at the format of the data and reproduce it exactly in a string.  Then convert it to a datetime. 

Datetime Type - Integer Types - Data Types - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5


Hope this is helpful.

Chris

It seems to not be a problem from the code, even when I do it manually I get a shorter time interval than what I request. It is not due to the data not being available, I have checked and there is data from 2017 onward. Here is a screenshot of what I mean. 

Files:
marketdata.png  47 kb
 
Suraj Rohira #:
It se

It seems to not be a problem from the code, even when I do it manually I get a shorter time interval than what I request. It is not due to the data not being available, I have checked and there is data from 2017 onward. Here is a screenshot of what I mean. 

How did you check that ?

 
Alain Verleyen #:

How did you check that ?

By trying to get data from 2003 until 2023, and I got from 2017 to 2023

 
Suraj Rohira #:

By trying to get data from 2003 until 2023, and I got from 2017 to 2023

On which timeframe ?

There could be a hole in history which would explain why you didn't get data for the first months of 2020.

 
Alain Verleyen #:

On which timeframe ?

There could be a hole in history which would explain why you didn't get data for the first months of 2020.

Same timeframe

 
Alain Verleyen #:

On which timeframe ?

There could be a hole in history which would explain why you didn't get data for the first months of 2020.

Yeah, just checked again and there is a hole in some places