//+------------------------------------------------------------------+ //| Export MarketInfo To CSV-file.mq4 | //| Copyright © 2007, Serega Lykov | //| http://mtexperts.narod.ru/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, Serega Lykov" #property link "http://mtexperts.narod.ru/" #property show_inputs extern int delay = 1000; // interval of time in seconds extern int timeframe = 1; // 1 = PERIOD_M1 // 5 = PERIOD_M5 // 15 = PERIOD_M15 // 30 = PERIOD_M30 // 60 = PERIOD_H1 // 240 = PERIOD_H4 // 1440 = PERIOD_D1 // 10080 = PERIOD_W1 // 43200 = PERIOD_MN1 // 0 = current chart extern bool replace_data = false; // true - the data in a file will be replaced on new // false - the new data will be added at the end of a file extern string file_name = "my_data"; // the name of the CSV-file receiving the data string script_link = "http://mtexperts.narod.ru/"; string script_name = "Script Export MarketInfo To CSV-file"; void deinit() { Comment(""); } //+------------------------------------------------------------------+ //| "periodically to save all symbols" | //+------------------------------------------------------------------+ int start() { // установим комментарий Comment(script_link,"\n",script_name); // бесконечный цикл while(true) { // открываем файл с именами символов int handle1 = FileOpenHistory("symbols.sel",FILE_BIN | FILE_READ); if(handle1 < 1) { Print("Error: the file symbols.sel is not accessible"); return(false); } if(replace_data == false) int handle2 = FileOpen(file_name+".csv",FILE_CSV | FILE_READ | FILE_WRITE,','); else handle2 = FileOpen(file_name+".csv",FILE_CSV | FILE_WRITE,','); if(handle2 < 1) { Print("Error: the file ",file_name,".csv is not accessible"); FileClose(handle1); return(false); } // если надо, переместим указатель if(replace_data == false) FileSeek(handle2,0,SEEK_END); int total = (FileSize(handle1)-4)/128; FileSeek(handle1,4,SEEK_SET); for(int i=0;i