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

 

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
 
RaptorUK: For clarity for myself, at least, and anyone else that has an interest . . .
Thats quite helpful ... Thank You.
 

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!

 
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.

 
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!
 
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.

 
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!
 

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.

 
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.
 
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.
 
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.