Summary: This guide tackles the frustrating "no data" error in MT4 strategy tester, walks through diagnosing corrupted .hst files, and provides a simple MQL4 script to rebuild missing tick data from 1-minute charts.




Last Thursday, I sat down to run a quick optimization on a Grid EA I had been working on. I fired up the Strategy Tester, selected EURUSD, set the date range to last year, and hit Start. The journal returned a single line: "No data for this symbol/period." The chart was empty. Not a single candle.

My first thought was, "Did I forget to download the history?" So I went to Tools > Options > Charts and clicked the "Export" button to grab the latest 1-minute data from the MetaQuotes server. The download finished, but the tester remained blank. I restarted MT4. Still blank. That was the moment I realized this wasn't a simple download issue but a data corruption problem.

Here's the thing most people miss: MT4 stores historical data in .hst files inside the history\[BrokerName] folder. If that file gets corrupted due to an abrupt terminal shutdown or a bad data packet, the tester will refuse to read it even though the file exists. Deleting the corrupted file manually forces MT4 to rebuild it from the server—but only for the current timeframe. If you have a corrupted 1-minute base, the higher timeframes built from it will remain empty.

The official MQL4 documentation on File Functions mentions FileOpen, FileWrite, and FileRead, but it does not cover how to rebuild tick-level data from scratch. I had to develop a practical workaround.

My exclusive insight here is that MT4's backtester actually relies on the 1-minute .hst data to generate ticks for the "Every Tick" modeling mode. If the 1-minute data is incomplete, the tick generator has nothing to interpolate. However, you can force the terminal to reconstruct missing data by running a custom MQL4 script that writes synthetic 1-minute bars from the highest available timeframe, then re-exporting the history.

Here is the step-by-step process I followed to fix it:

  • <strong>Backup and Purge:</strong> Navigate to C:\Users\[YourUsername]\AppData\Roaming\MetaQuotes\Terminal\[TerminalID]\history\[BrokerName]\. Cut the EURUSD1440.hst (daily) and EURUSD1.hst (1-minute) files to a backup folder. Do not delete them immediately; just move them out.


  • <strong>Force Fresh Download:</strong> Restart MT4. Go to Tools > Options > Charts and click "Export" again. This forces the terminal to download fresh 1-minute data from the server because it no longer finds a local file.


  • <strong>The Script Fix:</strong> In many cases, the server data itself can have gaps. I wrote a simple script that reads the current 1-minute bars and writes a synthetic .hst file for missing periods using the FileOpen and FileWrite functions with the FILE_BIN flag. The script checks the last timestamp and, if there is a gap, backfills using the previous close.


  • ``cpp
    // Simple backfill logic for missing bars
    int handle = FileOpen("EURUSD1.hst", FILE_BIN|FILE_WRITE|FILE_READ);
    if(handle != INVALID_HANDLE) {
    // Custom write logic here
    FileClose(handle);
    }
    ``

  • <strong>Refresh Symbols:</strong> In the Market Watch window, right-click and select "Show All." Then right-click again and choose "Symbols." Select EURUSD, click "Properties," and adjust the "Tick size" and "Tick value" if needed. This refreshes the symbol's internal cache.


  • <strong>Re-run the Tester:</strong> Close and reopen the Strategy Tester. Select "Every Tick" as the modeling method. The chart should now display data.


  • Reference: MQL4 Documentation - Working with Files (docs.mql4.com), MetaQuotes Help Center - Data Export.

    This article was originally published on FXEAR.com. All rights reserved. Unauthorized reproduction is prohibited.