Navigation:Home > Content >

OptionsExpire.mq4

Time: 2014-07-26 | Download file:OptionsExpire.mq4

//+------------------------------------------------------------------+
//|                                                InterestLines.mq4 |
//|                                           Copyright © 2006, Abhi |
//|                                http://www.megadelfi.com/experts/ |
//|                            E-mail: interestlines{Q)megadelfi.com |
//|                       fix my e-mail address before mailing me ;) |
//+------------------------------------------------------------------+
#property copyright "Abhi"
#property link      ""
#property show_inputs
#property indicator_chart_window

extern bool DisplayText = true;


extern color UpColor = Red;
extern color DownColor = Blue;

extern string FileName = "OptionsExpire.txt";

int start() {
}
int deinit() {
   ObjectsDeleteAll();
}
int init()
  {
  
 ObjectsDeleteAll();
  
   int handle;
   handle=FileOpen(FileName,FILE_CSV|FILE_READ,';');
   if(handle<1)
    {
     Print("File not found, the last error is ", GetLastError());
     return(false);
    }
    
    
   int i= 0;
   while(!FileIsEnding(handle))
   {
    string sDate=FileReadString(handle); // Date
    string sTime=FileReadString(handle); // Time
    string sDescription=FileReadString(handle); // Description
    string sCountry=FileReadString(handle); // Country
    string sPeriod=FileReadString(handle); // Period
    string sCurrent=FileReadString(handle); // Current value
    string sForecast=FileReadString(handle); // Expected
    FileReadString(handle); // null
    
    i++;
    datetime dt = StrToTime(sDate+" "+sTime);
    
         color c = Orange;
            
          if (DisplayText)
          {
          ObjectCreate(FileName+"_text"+i, OBJ_TEXT, 0, dt, Close[0]-0.1);
          ObjectSet(FileName+"_text"+i, OBJPROP_COLOR, c);          
          ObjectSetText(FileName+"_text"+i, sDescription + " "+ sCountry + " " + sPeriod + " " + sCurrent + " " + sForecast, 9);          
          ObjectSet(FileName+"_text"+i, OBJPROP_ANGLE, 90);          
          }
          
                   
          ObjectCreate(FileName+"_line"+i, OBJ_VLINE, 0, dt, Close[0]);
          ObjectSet(FileName+"_line"+i, OBJPROP_COLOR, c);                    
          ObjectSet(FileName+"_line"+i, OBJPROP_STYLE, STYLE_DOT);                    
          ObjectSet(FileName+"_line"+i, OBJPROP_BACK, true);          
          ObjectSetText(FileName+"_line"+i, sDescription + " "+ sCountry + " " + sPeriod + " " + sCurrent + " " + sForecast, 8);                    

   }    

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

Recommend