Skip to content
All library documents

Exporting MetaTrader 5 Rate and Tick History to CSV

Article MQL5 code base

Summary

This document explains a script for exporting historical rates and tick data from the symbol shown on the current MetaTrader 5 chart. It addresses a limitation in the platform’s built-in export facility, which may omit available tick history, by allowing users to save the full available history or a selected date range in the standard CSV format.

The script writes two CSV files to the platform’s data Files folder: one for rates and one for ticks. Users can set a start datetime and an exclusive stop datetime; leaving both unset selects all available history. Output filenames include the symbol, the rates timeframe, and the date range. The document describes a data-management utility rather than a trading method, and it offers no evidence about data completeness beyond its stated purpose or about how the exported data should be analyzed.

Key ideas

  • The script exports rates and ticks for the current chart symbol into separate CSV files.
  • It is intended to address gaps that may occur when exporting tick history through the platform dialog.
  • Users can export all available history or constrain the export with start and stop datetimes.
  • The stop datetime is excluded from processing, and the output files are saved in the platform’s Files folder.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.