Download MetaTrader 5
To add comments, please log in or register
Do you know C++? MQL5 has much in common with it. Just try it yourself!
MetaQuotes Software Corp.
Moderator
181001
MetaQuotes Software Corp. 2006.07.10 14:31 

New article Working with Files. An Example of Important Market Events Visualization has been published:

The article deals with the outlook of using MQL4 for more productive work at FOREX markets.

Author: Andrew Opeyda

MQL4 Comments
16319
MQL4 Comments 2006.07.22 09:14  
Hi,

This is a great functionality, but can't get it to work on my MT4 platform...no compile errors, script loads and unloads, but no text! :( Any help?
MQL4 Comments
16319
MQL4 Comments 2006.07.22 20:15  
Ok..figured it out..had a wrong directory (saved the week.txt in Meta Trader folder instead of InterBank folder..)...now, the script runs smoothly..really great! Power to ngel! :)
Yves
543
Yves 2006.07.30 07:53  
Can you traduct a week.txt file in english? Or did anybody build a week file (or month) for him self that can post it here or a link to a fresh made event file? Please?
Andrey Opeyda
1105
Andrey Opeyda 2006.08.28 15:55  
U can take data for week.txt in almost all economics calendars.
MQL4 Comments
16319
MQL4 Comments 2006.10.17 18:53  
Hello, I am trying to use your script for news. I have created 
very short txt file with news events.  It is:
16.10.2006; 3:00am  ;USA; 0       ; 0    ;0 
16.10.2006; 5:30am  ;USA; 0.008 ; 0.005 ;-0.003
16.10.2006; 5:30am  ;USA; 13.8 ; 11 ;22.9
16.10.2006; 10:00am ;USA; 0 ; 0 ;0 
16.10.2006; 10:30am ;USA; 0 ; 0 ;0 
16.10.2006; 12:40pm ;USA; 0 ; 0 ;0
However when, I run the script nothing happens.  
I have a 15 minute chart up for the 
EUR USD.
Thanks so much
Steve
//+------------------------------------------------------------------+
//|                                                 ReadFromFile.mq4 |
//|                                                       ·•°njel°•· |
//|                                                     iamnotlinked |
//+------------------------------------------------------------------+
#property copyright "·•°njel°•·"
#property link      "iamnotlinked"
#property show_inputs
 
extern bool DisplayText = true;
 
extern bool Japan = true;
extern bool USA = true;
extern bool Germany = true;
extern bool ES = true;
extern bool GB = true;
extern bool Canada = true;
 
extern string FileName = "\\experts\week.txt";
 
int start()
  {
  Alert("hello");  // *********** this also does not fire off
  ObjectsDeleteAll();
  
   int handle;
   handle=FileOpen(FileName,FILE_CSV|FILE_READ,';');
   if(handle<1)
    {
     /////// ************* neither of these two alerts fires either.
	Alert("File not found, the last error is ", GetLastError());
     return(false);
    }
    
   if(handle>=1)
    {
     Alert("File found ", FileName);
     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 = Red;
 
         if (sCountry == "ßïîíèÿ") c = Yellow;            
         if (sCountry == "ÑØÀ") c = White;         
         if (sCountry == "Ãåðìàíèÿ") c = Green;
         if (sCountry == "ÅÑ") c = Blue;            
         if (sCountry == "Áðèòàíèÿ") c = Orange;
         if (sCountry == "Êàíàäà") c = Gray;
 
 
         if ((sCountry == "ßïîíèÿ") && (!Japan)) continue;            
         if ((sCountry == "ÑØÀ") && (!USA)) continue;            
         if ((sCountry == "Ãåðìàíèÿ") && (!Germany)) continue;            
         if ((sCountry == "ÅÑ") && (!ES)) continue;            
         if ((sCountry == "Áðèòàíèÿ") && (!GB)) continue;                      
         if ((sCountry == "Êàíàäà") && (!Canada)) continue;                     
            
            
          if (DisplayText)
          {
          ObjectCreate("x"+i, OBJ_TEXT, 0, dt, Close[0]);
          ObjectSet("x"+i, OBJPROP_COLOR, c);          
          ObjectSetText("x"+i, sDescription + " "+ sCountry + " " + 
                        sPeriod + " " + sCurrent + " " + sForecast, 8);          
          ObjectSet("x"+i, OBJPROP_ANGLE, 90);          
          }
          
                   
          ObjectCreate("y"+i, OBJ_VLINE, 0, dt, Close[0]);
          ObjectSet("y"+i, OBJPROP_COLOR, c);                    
          ObjectSet("y"+i, OBJPROP_STYLE, STYLE_DOT);                    
          ObjectSet("y"+i, OBJPROP_BACK, true);          
          ObjectSetText("y"+i, sDescription + " "+ sCountry + " " + 
                        sPeriod + " " + sCurrent + " " + sForecast, 8);                    
   }    
   return(0);
  }
//+------------------------------------------------------------------+
okwh
1631
okwh 2006.12.07 14:58  
Ugly for so vis.

Could you mind to set a * symble as a mark only,
then when one click that * mark, then popup a small window to show details  like tootip ????
methasitwi
8
methasitwi 2013.03.19 12:58  
Thanks you very much. It's work for me.

Could anyone tell me what's indicator as below picture, I like it !

Thanks you everybody again.

Methasit W. / New programmer & Gold Trader.
MQL4 Comments
16319
MQL4 Comments 2013.07.22 23:51  
any one got it working ? I put it in scripts folder, it starts but then returns File not found error ! week.txt is in expert/Files/ folder and also expert/, and test folder !
MQL4 Comments
16319
MQL4 Comments 2013.07.27 13:37  
Ok the readfromfile.mq4 attachement has a mistyping, now works very well, thanks a lot
/
To add comments, please log in or register