CalendarArticle

Author: Copyright � 2006, MetaQuotes Software Corp.
Miscellaneous
Uses files from the file systemIt reads information from a file
0 Views
0 Downloads
0 Favorites
CalendarArticle
//+------------------------------------------------------------------+
//|                                                      new_day.mq4 |
//|                      Copyright © 2006, MetaQuotes Software Corp. |
//|                                        s05, selivanov.05@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window

extern string HtmlAdress = "http://www.dailyfx.com/calendar/cal.csv";
extern string GetrightAdress = "c:\progra~1\Wget\wget.exe";
extern string SaveTO = "c:\progra~1\BrocoInvestor\experts\files\html";


extern bool       Perevod = true;



extern bool       Lows = true;
extern bool       Medium = true;
extern bool       Highs = true;


extern int        GMT = 1; //âðåìåííîé ïîÿñ +X ÷àñà îòíîñèòåëüíî Ãðèíâè÷à
extern int        total_in_news = 0; //êîëè÷åñòâî îäíîâðåìåííî îòáîáðàæàåìûõ íîâîñòåé íà ãðàôèêå âûõîäÿùèõ â îäíî âðåìÿ (0-îäíà)


extern bool       AUD = false;
extern bool       EUR = false;
extern bool       USD = true;
extern bool       CHF = false;
extern bool       GBP = true;
extern bool       JPY = false;
extern bool       NZD = false;
extern bool       CAD = false;
 
#include <Time.mqh>
#import "kernel32.dll"
int WinExec(string NameEx, int dwFlags);
#import
// ïåðåìåííûå
 
 
      static int ccc2=0;
      static int sdvig=0;
      string Translate[500][2];


      string com;      



//
int Max = 0;
datetime LastTimeDownloading = 0;

void DownloadCalendar()
{
  Print("Downloading "+HtmlAdress+" to experts\files\html\cal.csv");
  WinExec(GetrightAdress+" -N "+HtmlAdress+" --directory-prefix="+SaveTO,0);
}
datetime PerviousMonday(datetime d)
{
  datetime res = d - (TimeDayOfWeek(d)-1)*24*60*60;
  return(res);
}
datetime ToDate(string stDate,string stTime) 
{
  string WeekDay = StringSubstr(stDate,0,3);
  int WeekPlus = 0;
  if (WeekDay=="Mon") WeekPlus=0;
  if (WeekDay=="Tue") WeekPlus=1;
  if (WeekDay=="Wed") WeekPlus=2;
  if (WeekDay=="Thu") WeekPlus=3;
  if (WeekDay=="Fri") WeekPlus=4;
  if (WeekDay=="Sat") WeekPlus=5;
  if (WeekDay=="Sun") WeekPlus=-1;
  
  datetime Res = PerviousMonday(GetTimeGMT())+WeekPlus*24*60*60;
  datetime Tm = StrToTime(stTime);
  Res=Res+TimeHour(Tm )*60*60+TimeMinute(Tm )*60+TimeSeconds(Tm )
         -TimeHour(Res)*60*60-TimeMinute(Res)*60-TimeSeconds(Res);  
  if (StringFind(stTime,"PM")>=0)       
    Res+=12*60*60;
//  Res=Res+2;//Äëÿ ìîèõ êîòðèîâîê âðåìåííîé ïîÿñ +2 ÷àñà îòíîñèòåëüíî Ãðèíâè÷à
    Res=Res+GMT*60*60;//Äëÿ ìîèõ êîòðèîâîê âðåìåííîé ïîÿñ +X ÷àñà îòíîñèòåëüíî Ãðèíâè÷à

  return (Res);
}

void GrabNews() 
{


  int file = FileOpen("\Html\cal.csv",FILE_READ|FILE_CSV,',');
  if (file==-1||FileSize(file)==0)
        return;
   
  int i=0;
  while (!FileIsEnding(file))
    {
      string stDate="";
      while (!FileIsEnding(file)&&stDate=="")
      
      stDate = StringSubstr(FileReadString(file),0,3);                         // Äàòà âûõîäà
      
      string AM_PM;int ccc=0;     
      string stTime = FileReadString(file);                                    // Âðåìÿ âûõîäà
      AM_PM = StringTrimLeft(StringSubstr(stTime,5,3));
      stTime = StringTrimRight(StringSubstr(stTime,0,5));
      if(AM_PM=="AM"&&StringSubstr(stTime,0,2)=="12"){stTime="00:"+StringSubstr(stTime,3,2);ccc=1;}
      if(AM_PM=="PM"&&StringSubstr(stTime,0,2)=="10"){stTime="22:"+StringSubstr(stTime,3,2);ccc=1;}
      if(AM_PM=="PM"&&StringSubstr(stTime,0,2)=="11"){stTime="23:"+StringSubstr(stTime,3,2);ccc=1;}
      if(AM_PM=="PM"&&StringSubstr(stTime,0,2)=="12"){stTime="12:"+StringSubstr(stTime,3,2);ccc=1;}
      
      if(ccc==0)
      {
      if(AM_PM=="PM"&&StringSubstr(stTime,0,1)=="1")stTime="13:"+StringSubstr(stTime,2,2);
      if(AM_PM=="PM"&&StringSubstr(stTime,0,1)=="2")stTime="14:"+StringSubstr(stTime,2,2);
      if(AM_PM=="PM"&&StringSubstr(stTime,0,1)=="3")stTime="15:"+StringSubstr(stTime,2,2);
      if(AM_PM=="PM"&&StringSubstr(stTime,0,1)=="4")stTime="16:"+StringSubstr(stTime,2,2);
      if(AM_PM=="PM"&&StringSubstr(stTime,0,1)=="5")stTime="17:"+StringSubstr(stTime,2,2);
      if(AM_PM=="PM"&&StringSubstr(stTime,0,1)=="6")stTime="18:"+StringSubstr(stTime,2,2);
      if(AM_PM=="PM"&&StringSubstr(stTime,0,1)=="7")stTime="19:"+StringSubstr(stTime,2,2);
      if(AM_PM=="PM"&&StringSubstr(stTime,0,1)=="8")stTime="20:"+StringSubstr(stTime,2,2);
      if(AM_PM=="PM"&&StringSubstr(stTime,0,1)=="9")stTime="21:"+StringSubstr(stTime,2,2);
      }



      // êîðåêòèðîâêà âðåìåíè GMT äëÿ âûâîäà íà ýêðàí
      int stTimeSTR;string stTimeKOR;int KOR=0;
      
      if(AM_PM=="AM"&&KOR==0&&StrToInteger(StringSubstr(stTime,0,2))==00)
      {      
      stTimeSTR=StrToInteger(StringSubstr(stTime,0,2));
      stTimeSTR=stTimeSTR+GMT;
      stTimeKOR=stTimeSTR+StringSubstr(stTime,2,3);
      KOR=1;
      }

      if(AM_PM=="AM"&&KOR==0&&StrToInteger(StringSubstr(stTime,0,2))==10)
      {      
      stTimeSTR=StrToInteger(StringSubstr(stTime,0,2));
      stTimeSTR=stTimeSTR+GMT;
      stTimeKOR=stTimeSTR+StringSubstr(stTime,2,3);
      KOR=1;
      }
      
      if(AM_PM=="AM"&&KOR==0&&StrToInteger(StringSubstr(stTime,0,2))==11)
      {      
      stTimeSTR=StrToInteger(StringSubstr(stTime,0,2));
      stTimeSTR=stTimeSTR+GMT;
      stTimeKOR=stTimeSTR+StringSubstr(stTime,2,3);
      KOR=1;
      }
      
      if(AM_PM=="AM"&&KOR==0)
      {      
      stTimeSTR=StrToInteger(StringSubstr(stTime,0,1));
      stTimeSTR=stTimeSTR+GMT;
      stTimeKOR=stTimeSTR+StringSubstr(stTime,1,4);
      KOR=1;
      }

      if(AM_PM=="PM"&&KOR==0&&StrToInteger(StringSubstr(stTime,0,2))==23&&GMT>0)
      {      
      stTimeSTR=StrToInteger(StringSubstr(stTime,0,2));
      stTimeSTR=GMT-1;
      stTimeKOR=stTimeSTR+StringSubstr(stTime,2,4);
      KOR=1;
      }
 
      if(AM_PM=="PM"&&KOR==0)
      {      
      stTimeSTR=StrToInteger(StringSubstr(stTime,0,2));
      stTimeSTR=stTimeSTR+GMT;
      stTimeKOR=stTimeSTR+StringSubstr(stTime,2,4);
      
      if(stTimeSTR==24){stTimeSTR=GMT-GMT;stTimeKOR=stTimeSTR+StringSubstr(stTime,2,4);} 
      if(stTimeSTR==25){stTimeSTR=GMT-GMT+1;stTimeKOR=stTimeSTR+StringSubstr(stTime,2,4);}
      if(stTimeSTR==26){stTimeSTR=GMT-GMT+2;stTimeKOR=stTimeSTR+StringSubstr(stTime,2,4);}
      if(stTimeSTR==27){stTimeSTR=GMT-GMT+3;stTimeKOR=stTimeSTR+StringSubstr(stTime,2,4);}
      if(stTimeSTR==28){stTimeSTR=GMT-GMT+4;stTimeKOR=stTimeSTR+StringSubstr(stTime,2,4);}
      if(stTimeSTR==29){stTimeSTR=GMT-GMT+5;stTimeKOR=stTimeSTR+StringSubstr(stTime,2,4);}
      if(stTimeSTR==30){stTimeSTR=GMT-GMT+6;stTimeKOR=stTimeSTR+StringSubstr(stTime,2,4);}
      if(stTimeSTR==31){stTimeSTR=GMT-GMT+7;stTimeKOR=stTimeSTR+StringSubstr(stTime,2,4);}
         
      KOR=1;
      }
      // END êîðåêòèðîâêà âðåìåíè GMT äëÿ âûâîäà íà ýêðàí 
      
      
      
      string stTime1;                                  //- åñëè äâà ñîáûòèÿ âûõîäÿò â îäèíàêîâîå âðåìÿ
      if((ccc2>=1)&&(stTime!=stTime1))
      {
      ccc2=0;
      sdvig=0;
      }
      if(stTime==stTime1)
      {
      ccc2=ccc2+1;
      if(Period()==5)sdvig=-500;
      if(Period()==15)sdvig=-1100;
      if(Period()==30)sdvig=-1900;
      if(Period()==60)sdvig=-5500;
      if(Period()==240)sdvig=-7000;
      }
      stTime1=stTime;
   
   
     

      
      string stTimeZone = FileReadString(file);                                //---      
      string stCurrency = FileReadString(file);                                // Òèï âàëþòû
      string stDescription = StringSubstr(FileReadString(file),4,50);          // Íàçâàíèå íîâîñòè

      
      string stImportance = FileReadString(file);            //---Âàæíîñòü
      string stActual = FileReadString(file);                //---
      string stForecast = FileReadString(file);              //---
      string stPrevious = FileReadString(file);              //---

// ÎÁÐÀÁÎÒÊÀ ÂÀÆÍÎÑÒÜ ÍÎÂÎÑÒÈ
 color c=Green;
 if (stImportance=="Low") c = DarkGreen;
 if (stImportance=="Medium") c = GreenYellow;
 if (stImportance=="High") c = Maroon;
// end ÎÁÐÀÁÎÒÊÀ ÂÀÆÍÎÑÒÜ ÍÎÂÎÑÒÈ

// ÎÁÐÀÁÎÒÊÀ ÏÅÐÅÂÎÄÀ ÍÎÂÎÑÒÈ   
   if (Perevod)
{           
      int fhandle = FileOpen("translate.txt", FILE_READ);
         while(!FileIsEnding(fhandle))
         {
            string str = FileReadString(fhandle);
            Translate[i][0] = str;
            Translate[i][1] = FileReadString(fhandle);
            
            if(StringSubstr(stDescription,0,11)==StringSubstr(str,0,11)){stDescription=Translate[i][1];}
         }
         FileClose(fhandle);
}
//  end ÎÁÐÀÁÎÒÊÀ ÏÅÐÅÂÎÄÀ ÍÎÂÎÑÒÈ

//ôèëüò äëÿ âûâîäà íà Comment
  int WeekPlus = 0;
  if (stDate=="Mon") WeekPlus=0;
  if (stDate=="Tue") WeekPlus=1;
  if (stDate=="Wed") WeekPlus=2;
  if (stDate=="Thu") WeekPlus=3;
  if (stDate=="Fri") WeekPlus=4;
  if (stDate=="Sat") WeekPlus=5;
  if (stDate=="Sun") WeekPlus=-1;
//-----------------------------





      datetime Date = ToDate(stDate,stTime);      

      if ((stImportance=="Low"&&Lows==true)||(stImportance=="Medium"&&Medium==true)||(stImportance=="High"&&Highs==true))  // ôèëüò ïî âàæíîñòè
      {
      if(stCurrency=="AUD"&&AUD==true)
      {
      if(WeekPlus==(DayOfWeek()-1))com = com +" "+stCurrency+" "+stTimeKOR+" "+stDescription + " / "+stImportance+"\n"; if(ccc2<=total_in_news) { 
      ObjectCreate("CalendarText"+i, OBJ_TEXT, 0, Date+sdvig, Close[0]);ObjectSet("CalendarText"+i, OBJPROP_COLOR, c);ObjectSetText("CalendarText"+i,stCurrency+" "+stTimeKOR+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);ObjectSet("CalendarText"+i, OBJPROP_ANGLE, 90);                   
      ObjectCreate("CalendarLine"+i, OBJ_VLINE, 0, Date, Close[0]);ObjectSet("CalendarLine"+i, OBJPROP_COLOR, c);ObjectSet("CalendarLine"+i, OBJPROP_STYLE, STYLE_DOT);ObjectSet("CalendarLine"+i, OBJPROP_BACK, true);ObjectSetText("CalendarLine"+i, stCurrency+" "+stTime+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);     
      }}     
      if(stCurrency=="EUR"&&EUR==true)
      {
      if(WeekPlus==(DayOfWeek()-1))com = com +" "+stCurrency+" "+stTimeKOR+" "+stDescription + " / "+stImportance+"\n"; if(ccc2<=total_in_news) { 
      ObjectCreate("CalendarText"+i, OBJ_TEXT, 0, Date+sdvig, Close[0]);ObjectSet("CalendarText"+i, OBJPROP_COLOR, c);ObjectSetText("CalendarText"+i,stCurrency+" "+stTimeKOR+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);ObjectSet("CalendarText"+i, OBJPROP_ANGLE, 90);                   
      ObjectCreate("CalendarLine"+i, OBJ_VLINE, 0, Date, Close[0]);ObjectSet("CalendarLine"+i, OBJPROP_COLOR, c);ObjectSet("CalendarLine"+i, OBJPROP_STYLE, STYLE_DOT);ObjectSet("CalendarLine"+i, OBJPROP_BACK, true);ObjectSetText("CalendarLine"+i, stCurrency+" "+stTime+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);     
      }} 
      if(stCurrency=="USD"&&USD==true)
      {      
      if(WeekPlus==(DayOfWeek()-1))com = com +" "+stCurrency+" "+stTimeKOR+" "+stDescription + " / "+stImportance+"\n"; if(ccc2<=total_in_news) { 
      ObjectCreate("CalendarText"+i, OBJ_TEXT, 0, Date+sdvig, Close[0]);ObjectSet("CalendarText"+i, OBJPROP_COLOR, c);ObjectSetText("CalendarText"+i,stCurrency+" "+stTimeKOR+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);ObjectSet("CalendarText"+i, OBJPROP_ANGLE, 90);                   
      ObjectCreate("CalendarLine"+i, OBJ_VLINE, 0, Date, Close[0]);ObjectSet("CalendarLine"+i, OBJPROP_COLOR, c);ObjectSet("CalendarLine"+i, OBJPROP_STYLE, STYLE_DOT);ObjectSet("CalendarLine"+i, OBJPROP_BACK, true);ObjectSetText("CalendarLine"+i, stCurrency+" "+stTime+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);     
      }}
      if(stCurrency=="CHF"&&CHF==true)
      {
      if(WeekPlus==(DayOfWeek()-1))com = com +" "+stCurrency+" "+stTimeKOR+" "+stDescription + " / "+stImportance+"\n"; if(ccc2<=total_in_news) { 
      ObjectCreate("CalendarText"+i, OBJ_TEXT, 0, Date+sdvig, Close[0]);ObjectSet("CalendarText"+i, OBJPROP_COLOR, c);ObjectSetText("CalendarText"+i,stCurrency+" "+stTimeKOR+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);ObjectSet("CalendarText"+i, OBJPROP_ANGLE, 90);                   
      ObjectCreate("CalendarLine"+i, OBJ_VLINE, 0, Date, Close[0]);ObjectSet("CalendarLine"+i, OBJPROP_COLOR, c);ObjectSet("CalendarLine"+i, OBJPROP_STYLE, STYLE_DOT);ObjectSet("CalendarLine"+i, OBJPROP_BACK, true);ObjectSetText("CalendarLine"+i, stCurrency+" "+stTime+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);     
      }}  
      if(stCurrency=="GBP"&&GBP==true)
      {      
      if(WeekPlus==(DayOfWeek()-1))com = com +" "+stCurrency+" "+stTimeKOR+" "+stDescription + " / "+stImportance+"\n"; if(ccc2<=total_in_news) {       
      ObjectCreate("CalendarText"+i, OBJ_TEXT, 0, Date+sdvig, Close[0]);ObjectSet("CalendarText"+i, OBJPROP_COLOR, c);ObjectSetText("CalendarText"+i,stCurrency+" "+stTimeKOR+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);ObjectSet("CalendarText"+i, OBJPROP_ANGLE, 90);                   
      ObjectCreate("CalendarLine"+i, OBJ_VLINE, 0, Date, Close[0]);ObjectSet("CalendarLine"+i, OBJPROP_COLOR, c);ObjectSet("CalendarLine"+i, OBJPROP_STYLE, STYLE_DOT);ObjectSet("CalendarLine"+i, OBJPROP_BACK, true);ObjectSetText("CalendarLine"+i, stCurrency+" "+stTime+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);     
      }}       
      if(stCurrency=="AUD"&&AUD==true)
      {
      if(WeekPlus==(DayOfWeek()-1))com = com +" "+stCurrency+" "+stTimeKOR+" "+stDescription + " / "+stImportance+"\n"; if(ccc2<=total_in_news) { 
      ObjectCreate("CalendarText"+i, OBJ_TEXT, 0, Date+sdvig, Close[0]);ObjectSet("CalendarText"+i, OBJPROP_COLOR, c);ObjectSetText("CalendarText"+i,stCurrency+" "+stTimeKOR+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);ObjectSet("CalendarText"+i, OBJPROP_ANGLE, 90);                   
      ObjectCreate("CalendarLine"+i, OBJ_VLINE, 0, Date, Close[0]);ObjectSet("CalendarLine"+i, OBJPROP_COLOR, c);ObjectSet("CalendarLine"+i, OBJPROP_STYLE, STYLE_DOT);ObjectSet("CalendarLine"+i, OBJPROP_BACK, true);ObjectSetText("CalendarLine"+i, stCurrency+" "+stTime+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);     
      }} 
      if(stCurrency=="JPY"&&JPY==true)
      {
      if(WeekPlus==(DayOfWeek()-1))com = com +" "+stCurrency+" "+stTimeKOR+" "+stDescription + " / "+stImportance+"\n"; if(ccc2<=total_in_news) { 
      ObjectCreate("CalendarText"+i, OBJ_TEXT, 0, Date+sdvig, Close[0]);ObjectSet("CalendarText"+i, OBJPROP_COLOR, c);ObjectSetText("CalendarText"+i,stCurrency+" "+stTimeKOR+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);ObjectSet("CalendarText"+i, OBJPROP_ANGLE, 90);                   
      ObjectCreate("CalendarLine"+i, OBJ_VLINE, 0, Date, Close[0]);ObjectSet("CalendarLine"+i, OBJPROP_COLOR, c);ObjectSet("CalendarLine"+i, OBJPROP_STYLE, STYLE_DOT);ObjectSet("CalendarLine"+i, OBJPROP_BACK, true);ObjectSetText("CalendarLine"+i, stCurrency+" "+stTime+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);     
      }} 
      if(stCurrency=="NZD"&&NZD==true)
      {
      if(WeekPlus==(DayOfWeek()-1))com = com +" "+stCurrency+" "+stTimeKOR+" "+stDescription + " / "+stImportance+"\n"; if(ccc2<=total_in_news) { 
      ObjectCreate("CalendarText"+i, OBJ_TEXT, 0, Date+sdvig, Close[0]);ObjectSet("CalendarText"+i, OBJPROP_COLOR, c);ObjectSetText("CalendarText"+i,stCurrency+" "+stTimeKOR+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);ObjectSet("CalendarText"+i, OBJPROP_ANGLE, 90);                   
      ObjectCreate("CalendarLine"+i, OBJ_VLINE, 0, Date, Close[0]);ObjectSet("CalendarLine"+i, OBJPROP_COLOR, c);ObjectSet("CalendarLine"+i, OBJPROP_STYLE, STYLE_DOT);ObjectSet("CalendarLine"+i, OBJPROP_BACK, true);ObjectSetText("CalendarLine"+i, stCurrency+" "+stTime+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);     
      }}
      if(stCurrency=="CAD"&&CAD==true)
      {
      if(WeekPlus==(DayOfWeek()-1))com = com +" "+stCurrency+" "+stTimeKOR+" "+stDescription + " / "+stImportance+"\n"; if(ccc2<=total_in_news) { 
      ObjectCreate("CalendarText"+i, OBJ_TEXT, 0, Date+sdvig, Close[0]);ObjectSet("CalendarText"+i, OBJPROP_COLOR, c);ObjectSetText("CalendarText"+i,stCurrency+" "+stTimeKOR+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);ObjectSet("CalendarText"+i, OBJPROP_ANGLE, 90);                   
      ObjectCreate("CalendarLine"+i, OBJ_VLINE, 0, Date, Close[0]);ObjectSet("CalendarLine"+i, OBJPROP_COLOR, c);ObjectSet("CalendarLine"+i, OBJPROP_STYLE, STYLE_DOT);ObjectSet("CalendarLine"+i, OBJPROP_BACK, true);ObjectSetText("CalendarLine"+i, stCurrency+" "+stTime+" : "+ stDescription+" ["+stActual+" "+stForecast+" "+stPrevious+" ]", 8);     
      }}  
      }                    

    
      i++;
      
    }
  Max = i;
  if (file!=-1)
    FileClose(file);


      Comment("");
      Comment(com);


    
}

void DeleteObjects()
{
   for (int i = 0; i<Max;i++)
     {
      com="";
      ObjectDelete("CalendarText"+i);
      ObjectDelete("CalendarLine"+i);
     }
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   DeleteObjects();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   if (TimeCurrent()>LastTimeDownloading+15*60)
     {
       DeleteObjects();
       DownloadCalendar();
       LastTimeDownloading = TimeCurrent();
       
       int file=-1;
       while (file==-1)
         file = FileOpen("\Html\cal.csv",FILE_READ|FILE_CSV,',');
       FileClose(file);

       GrabNews();
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments