Export historical data – script MetaTrader 5

The script purpose is to export historical rates data to format, convenient for analysis in external programs, for example, in MathCad (example is attached).

The output file contain the historical price data (bars) of the specified month in the following form:

 DoubleToString(rates[i].time,0),      // number of seconds, passed from 1 Janunary 1970
              rates[i].open,         // Open
              rates[i].high,         // High
              rates[i].low,          // Low
              rates[i].close,        // Close
              rates[i].tick_volume,  // Tick Volume
              tm.year,               // year
              tm.mon,                // month
              tm.day,                // day
              tm.hour,               // hour
              tm.min,                // minutes
              tm.day_of_week,        // week day (0-sunday, 1-monday)
              tm.day_of_year);       // day index in the year (1st January is the 0-th day of the year)


📈 ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks