MetaTrader History Toolkit
v1.1.0.2
2018-10-31
Copyright  2012-2018 Heinz Traub
www.tripleheinz.com/index.php?page=mtht



INDEX

1. INTRODUCTION
2. THE TOOLS
3. REQUIREMENTS
4. INSTALLATION
5. NOTES



1. INTRODUCTION

MetaTrader History Toolkit is a small set of tools that provides developers and traders with
different approaches to DDE servers for accessing history data outside the MetaTrader terminal.
These tools work by directly reading history files through the "HCC API", which is an interface
for the file structure.

Traders can use the tools just like any other program and perform some filtering before exporting
data to CSV format (Microsoft Excel compatible). In the other hand, developers can directly access
the HCC API and map history data in system memory, once there, the possibilities are endless.

2. THE TOOLS

[HCC API]

Not being precisely a software tool, the HCC API is a series of declarations, conventions and
specifications created to promote a common interface to work with MetaTrader history files.

[HCC Library]

The HCC Library is the first 3rd party implementation of the HCC API, being the official one
considered the private work from MetaQuotes (who created the file format) even if both foundations
do not entirely comply between each other. The HCC Library has been conceived as a C DLL, it is fully
documented and it has been developed with the D programming language spec 2. It can be used with any
language with C ABI compatibility and support for DLL imports. Bindings and examples for popular
languages are provided. Although using this API with MQL5 is kind of odd (data is already there in
the terminal), bindings will still be provided for advanced arbitrary use (i.e. comparing data from
current account with data from another broker). It also features automatic memory management,
this means that you do not need to worry about memory allocation and deallocation.

This library is used by the other tools and you can use it too in programs made by you.

[HCC Command Line]

Convenient and quick tool for easy exporting HCC files to CSV files.

To use this tool simple drag and drop valid history files to the executable file and all their rates
will be automatically exported to a CSV file in M1 timeframe.

[HCC Explorer]

Graphical user interface to view and analyze HCC files. Filtering can be applied before exporting data.
Rates can be completely modified on-screen in case you need to fix rates that are considered corrupt.
You can freely edit history files to suit your needs. File integrity can be validated by activating a
couple of options or you can just edit unrestrained! (under your own risk).

If you need a more refined work with history such as date filtering or timeframe convertion, you can use
this tool for these purposes and then finally export the resulting rates to a CSV file. You can also use
this tool to simply visualize rates of a history file.

It is a Windows GUI application, just open and use it.

[Examples]

A couple of source code examples are provided along with bindings for certain popular languages.
More languages will be added in future releases or you can create your own bindings by translating one
of the import files.



3. REQUIREMENTS

[Hardware]

- 266 Mhz (or more) x86 CPU. 32 and 64 bits processors are supported.
- 32 MiB (or more) of system memory (RAM). You will need more for working with rates in memory.
- 2,5 MiB of available storage space. You will need more for storing exported rates.

[Software]

- Microsoft Windows 2000/XP/Vista/7/8/10 or newer host OS.
- All the tools are native applications and do not have extra software requeriments.
- Matching 32/64 bits OS for working with the corresponding version of the HCC Library.
  The rest of the tools can be run in 32 and 64 bits systems alike.
- Matching 32/64 bits version of MetaTrader for making an Expert Advisor, indicator or script
  that uses the corresponding version of the HCC Library.
- The toolkit only works with MetaTrader 5 history files. Users of MetaTrader 4 can use the
  History Center (F2) to import/export history data.



4. INSTALLATION

All files come packaged in a ZIP file and you just need an archiver program such as WinZIP, WinRAR,
7-Zip or the like to unpack the files to a folder of your preference.
To uninstall the tools simply delete the folder you used to unpack. The toolkit is clean and it doesn't
write keys to the Windows registry.



5. NOTES

- Timeframe Computation: It means generation of rates with a period greater than 1 minute.
  Please note that this feature is still experimental and you might not get the results you'd want.
  The generated data differs from the data in MetaTrader. It was clear since the beginning that this project
  was made for working natively with 1 minute history data. For other periods use a DDE Server.
  Do not sacrifice precision and integrity. Just stick to M1 period for the time being.
- If you are making your own bindings for an unsupported language please take into consideration that the
  language must support unsigned integers. Most but not all values returned by the HCC Library fit in the
  positive range of a signed integer but this can not be guaranteed.
  You should also consider the struct alignment which in fact is set to none. Members of a structure in the
  HCC Library are packed together just like they are in MQL5.
- Now that the HCC API has read/write capabilities, it is worth mentioning that the HCC Library is thread safe.
  Multiple threads are mutually excluded.
- Before modifying history files, remember to ALWAYS backup your history (.hcc) and cache (.hc) files.
  While modifying history files, remember to keep MetaTrader closed to avoid I/O conflicts.
  After modifying history files, remember to reconstruct your precomputed timeframe cache files by deleting
  all the files in the "cache" subfolder while MetaTrader is closed. Then after that you can launch MetaTrader
  again and let it reconstruct the cache.



MetaTrader is Copyright 2000-2018, MetaQuotes Software Corp.