Wednesday 8 December 2010

Forex MetaTrader 5 HCC to CVS

Meta Trader 5, store history data in HCC files.
The quickest ways to get all the history data is to run a Strategy Tester on the entire history.

History files are store at MetaTrader 5\Bases\MetaQuotes-Demo\history\.

Don't exactly know what's the entire structural, but know enough to extract what we want, the history data.

Data Structural


4 byte, seperator , little endian encoding 18385028, hex(84 88 18 01)
4 byte, time, int divisible by 60
8 byte, double open
8 byte, double high
8 byte, double low
8 byte, double close
1 byte, char | small int spread
1 byte, char | small int tick volume

The data repeat over and over for each day.

I made one in c++, it ugle :D,
Just switch to ubuntu again, lost all my IDE :(
SRC: http://example.citium.net/forex/HccReader.cpp
BIN: http://example.citium.net/forex/HccReader

4 comments:

  1. do you know how to create your own hcc file compatible with mt5 historical data? ... actually i would like to convert my tick data from dukascopy to mt5 format

    ReplyDelete
  2. OMG!!! this is a wonderful job and discovery!
    I wonder how did you manage to recognize the file structure. This might took you hours!
    Anyway, thank you so much for sharing this info.

    Not completely sure about this but while i was checking out most EURUSD files i noticed that in all of them, data starts at offset 15337 (hex 3BE9). Haven't checked other symbols.

    Also, i think you have a bug either in this page or in your C++ program. You see, here in this blog entry you say that the last 2 bytes of the structure are spread and tick volume respectively but your program is reading them in reverse order. Better check it out, maybe my mistake. I'm new to Forex so i'm not quite sure wich order is correct but something tells me that your program is right: Bytes are volume then spread.
    Looking for Bugs? hehehe

    Cheers

    ReplyDelete
  3. Hey there,

    Have you cracked the entire structure yet?

    ReplyDelete
  4. Hello !
    Useful discovery and the only in all the internet HCC format considering.
    Can you update the .CPP source, since in that site hosting it is unaccessible ..

    ReplyDelete