Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Save History to HST - MetaTrader 5 Script | Forex Indicators Download - MT4/MT5 Resources

author EAcpu | 3 reads | 0 comments |

Save history to HST - script for MetaTrader 5

Save history to HST - script for MetaTrader 5

This script allows the creation of binary *.hst files supported by MetaTrader 4. The file can be imported into MetaTrader 4 as historical data and can also be opened as an offline chart.

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

Initially, the script was designed for checking indicators, written in MQL4 and MQL5, since the same data is required for comparison.

To check indicator values, follow these steps:

1. Install the indicator "Zerolag MACD":

MetaTrader 4:- https://www.mql5.com/ru/code/9993
MetaTrader 5:- https://www.mql5.com/en/code/170

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

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

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

Copy this file to the MetaTrader 4 client folder: \history\<server type>\, for example:

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

Import a file containing history into the MetaTrader 4 client terminal (offline) by selecting "File" -> "Open Offline".

Save history to HST - script for MetaTrader 5

4. Launch the indicator on the MetaTrader 4 offline chart and launch it in MetaTrader 5 and you will see that they both have the same value.

Save history to HST - script for MetaTrader 5

Check them visually at the end.


Attachment download

📎 savehistorytohst.mq5 (4.09 KB)

Source: MQL5 #780

Verification code Refresh