//+------------------------------------------------------------------+ //| output_history.mq4 | //| Copyright © 2007, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { // Repeat the following line of code for each currency pair and timeframe, and then press F5 to recompile (or restart MT4) // First parameter must be a valid currency pair, e.g. GBPUSD // Second parameter must be valid timeframe, i.e. one of 1, 5, 15, 30, 60 (=H1), 240 (=H4), 1440 (daily), 10080 (weekly), 43200 (monthly) // To use the currently displayed chart: out_hist(Symbol(),Period()); out_hist("GBPUSD",1440); // This will produce daily history for GBPUSD // return(0); } // int out_hist(string ccy, int tf) { string fname = ccy + "," + tf + ".csv"; int handle = FileOpen(fname, FILE_CSV|FILE_WRITE, ","); if(handle>0) { FileWrite(handle,"Date,Time,Open,Low,High,Close,Volume"); // header for(int i=0; i