Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

MetaTrader 5 Script | Export historical data

MetaTrader Experts, Indicators, Scripts and Libraries

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)
124

Best MetaTrader Indicators + Profitable Expert Advisors