Download MetaTrader 5

Watch how to download trading robots for free

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2011.12.27 08:08
Save history to HST

Save history to HST - script for MetaTrader 5

| English Русский 中文 Español Deutsch 日本語 Português

votes: 26


This script allows to create a binary *.hst file, supported by MetaTrader 4. This file can be imported in MetaTrader 4 as historical data or you can open it as offline chart.

It has only one DATA_COUNT input parameter, which specifies data count in bars, starting from current.

Initially, this script was designed for checking of the indicators, written in MQL4 and MQL5, because the same data needed for the compare.

To check the indicator values, follow these steps:

1. Install indicators "Zerolag MACD":

MetaTrader 4: -
MetaTrader 5: -

2. Install this script in MetaTrader 5 and launch it.

3. If successful, it will print a message with path of the file created, for example:

2011.12.26 20:23:27 SaveHistoryToHST (EURUSD,M1) Path to file: C:\Program Files\MetaTrader 5\MQL5\Files\!EURUSD1.hst

Copy this file to  MetaTrader 4 client terminal folder: <MetaTrader 4 Folder>\history\<Server type>\, for example:

C:\Program Files (x86)\MetaTrader 4\history\Alpari-Micro3\ 

Import file with the history to MetaTrader 4 client terminal as offline, by choosing  File -> Open Offlie.

4. Launch the indicator on the MetaTrader 4 offline chart and launch it in MetaTrader 5, you will see that both of them have the same values.

Save history to HST

And at last check them visually.

Translated from Russian by MetaQuotes Software Corp.
Original code:

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

Average Directional Movement Index (ADX) Average Directional Movement Index (ADX)

The Average Directional Movement Index Indicator (ADX) helps to determine if there is a price trend.

Closed_TOTAL Closed_TOTAL

Total closure of all positions (winners/losers). You can also select which are of a single instrument.

Closed_LOSS Closed_LOSS

Closure of all positions with a loss. (You can indicate a specific instrument if you want to).