Download MetaTrader 5

.hst file format . . . Old and New (Jan 2014)

To add comments, please log in or register
Order the development and track its status via your mobile phone.
Simon Gniadkowski
Moderator
18001
Simon Gniadkowski 2014.01.29 22:51 

For clarity for myself, at least, and anyone else that has an interest . . .

.hst file format valid as of MT4 Build 509

The database header first . . . total 148 bytes

intversion; // database version - 4004 bytes
stringcopyright[64];// copyright info64 bytes
stringsymbol[12];// symbol name12 bytes
intperiod; // symbol timeframe4 bytes
intdigits;// the amount of digits after decimal point4 bytes
datetimetimesign; // timesign of the database creation4 bytes
datetimelast_sync; // the last synchronization time4 bytes
intunused[13];// to be used in future52 bytes


then the bars array (single-byte justification) . . . total 44 bytes

datetimectm;// bar start time4 bytes
doubleopen;// open price8 bytes
doublelow;// lowest price8 bytes
doublehigh;// highest price8 bytes
doubleclose;// close price8 bytes
doublevolume;// tick count8 bytes



.hst file format valid as of MT4 574 and later

The database header is the same . . . total 148 bytes

intversion; // database version - 4014 bytes
stringcopyright[64];// copyright info64 bytes
stringsymbol[12];// symbol name12 bytes
intperiod; // symbol timeframe4 bytes
intdigits;// the amount of digits after decimal point4 bytes
datetimetimesign; // timesign of the database creation4 bytes
datetimelast_sync; // the last synchronization time4 bytes
intunused[13];// to be used in future52 bytes


then the bars array (single-byte justification) . . . total 60 bytes

datetimectm;// bar start time8 bytes
doubleopen;// open price8 bytes
doublehigh;// highest price8 bytes
doublelow;// lowest price8 bytes
doubleclose;// close price8 bytes
longvolume;// tick count8 bytes
intspread;// spread4 bytes
longreal_volume;// real volume8 bytes
Ubzen
5394
Ubzen 2014.01.29 23:23  
RaptorUK: For clarity for myself, at least, and anyone else that has an interest . . .
Thats quite helpful ... Thank You.
Fernando Carreiro
2348
Fernando Carreiro 2014.01.30 04:15  

Thank you RaptorUK!

This information is most useful. I make extensive use of writing HST files in order to store all sorts of statistical data and these changes are going to affect many of my EA's

Do you perhaps know what the "database version" is for the new format?

Did MetaQuotes (or other entity) release a detailed description of the new format or did you reverse engineer the information?

In the case that the information was provide by MetaQuotes or other entity, do you perhaps have a link to it?

Again, many thanks!

Simon Gniadkowski
Moderator
18001
Simon Gniadkowski 2014.01.30 09:06  
FMIC:

Thank you RaptorUK!

This information is most useful. I make extensive use of writing HST files in order to store all sorts of statistical data and these changes are going to affect many of my EA's

Do you perhaps know what the "database version" is for the new format?

Did MetaQuotes (or other entity) release a detailed description of the new format or did you reverse engineer the information?

In the case that the information was provide by MetaQuotes or other entity, do you perhaps have a link to it?

Again, many thanks!

New version is 401


MetaQuotes did not give me the specification despite me asking via the Service Desk, I found the old version in the Terminal Help file and the new version was determined from the new Period converter.

Fernando Carreiro
2348
Fernando Carreiro 2014.01.30 09:18  
RaptorUK:

New version is 401

MetaQuotes did not give me the specification despite me asking via the Service Desk, I found the old version in the Terminal Help file and the new version was determined from the new Period converter.


Thanks!
gchrmt4
356
gchrmt4 2014.01.30 09:18  
FMIC:

In the case that the information was provide by MetaQuotes or other entity, do you perhaps have a link to it?

https://www.mql5.com/en/forum/148851/page13#898049

The PeriodConverter.mq4 in the new MT4 build demonstrates the format, just like the old period_converter.mq4 demonstrated the old format. Each record in the HST is now a MqlRates structure. The header is unchanged except for the version number.

Fernando Carreiro
2348
Fernando Carreiro 2014.01.30 15:18  
gchrmt4:

https://www.mql5.com/en/forum/148851/page13#898049

The PeriodConverter.mq4 in the new MT4 build demonstrates the format, just like the old period_converter.mq4 demonstrated the old format. Each record in the HST is now a MqlRates structure. The header is unchanged except for the version number.

Thanks!
Fernando Carreiro
2348
Fernando Carreiro 2014.01.30 15:33  

In regards to the "Spread", is it the average spread for the bar, or is it the spread at the Close of the bar?

I search the MQL5 documentation but it is not explicit about that fact.

Ubzen
5394
Ubzen 2014.01.30 16:47  
FMIC:

In regards to the "Spread", is it the average spread for the bar, or is it the spread at the Close of the bar?

I search the MQL5 documentation but it is not explicit about that fact.

https://www.mql5.com/en/forum/17858/page2#comment_731798.
Simon Gniadkowski
Moderator
18001
Simon Gniadkowski 2014.01.30 16:49  
FMIC:

In regards to the "Spread", is it the average spread for the bar, or is it the spread at the Close of the bar?

I search the MQL5 documentation but it is not explicit about that fact.

It's not been implemented yet . . . so there is no correct answer https://forum.mql4.com/60417/page7#900804 at the moment.
Alain Verleyen
Moderator
30742
Alain Verleyen 2014.01.30 17:54  
FMIC:

In regards to the "Spread", is it the average spread for the bar, or is it the spread at the Close of the bar?

I search the MQL5 documentation but it is not explicit about that fact.

In MT5, it's the highest spread on the candle interval.
123
To add comments, please log in or register