//+------------------------------------------------------------------+
//|                                                        Умник.mq4 |
//|                                                  Aleksandr Komar |
//|                                           http://www.akgnozis.ru |
//+------------------------------------------------------------------+
#property copyright "Aleksandr Komar"
#property link      "http://www.akgnozis.ru"
extern datetime smHour = D'01.01.2001 04:00';
extern datetime startDate = D'03.02.2007 02:00';
extern int divAmount = 100000;
extern bool DataOn = TRUE;
extern bool marketOrderOn = FALSE;
extern double spred = 0.0005;

void Data() {
   int l_file_4;
   string ls_12;
   int li_20;
   int li_0 = 0;
   int li_8 = 0;
   if (saveDataOn != FALSE) {
      li_0 = (3600 * Day() + 60 * TimeHour(Time[0]) + TimeMinute(Time[0])) / Period();
      if (li_0 != GlobalVariableGet("datePrev" + Symbol())) {
         GlobalVariableDel("datePrev" + Symbol());
         GlobalVariableSet("datePrev" + Symbol(), li_0);
         l_file_4 = FileOpen("Data_" + Symbol() + ".txt", FILE_CSV|FILE_WRITE|FILE_READ, ",");
         if (l_file_4 != -1) {
            for (li_8 = Bars; li_8 > 0; li_8--) {
               if (Time[li_8] > startDate) {
                  startDate = Time[li_8];
                  GlobalVariableDel("startDate" + Symbol());
                  GlobalVariableSet("startDate" + Symbol(), startDate);
                  ls_12 = DoubleToStr(TimeYear(Time[li_8]), 0);
                  li_20 = Time[li_8] + (smHour - D'01.01.2001 02:00' + 300);
                  if (TimeMonth(li_20) < 10) ls_12 = ls_12 + "0" + DoubleToStr(TimeMonth(li_20), 0);
                  else ls_12 = ls_12 + DoubleToStr(TimeMonth(li_20), 0);
                  if (TimeDay(li_20) < 10) ls_12 = ls_12 + "0" + DoubleToStr(TimeDay(li_20), 0);
                  else ls_12 = ls_12 + DoubleToStr(TimeDay(li_20), 0);
                  ls_12 = ls_12 + "," + DoubleToStr(TimeHour(li_20), 0) + ":" + DoubleToStr(TimeMinute(li_20), 0) + ":" + DoubleToStr(TimeSeconds(li_20), 0);
                  FileSeek(l_file_4, 0, SEEK_END);
                  FileWrite(l_file_4, Symbol(), Period(), ls_12, Open[li_8], High[li_8], Low[li_8], Close[li_8], 0);
               }
            }
            FileClose(l_file_4);
         }
      }
   }
}

int init() {
   int l_global_var_0;

}

int deinit() {

}

int start() {
   bool l_ord_close_0;
   int l_ticket_12;
   int l_cmd_16;
   int l_file_24;
   string ls_unused_60;
   string l_comment_76;

}