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 = "week.txt";
int start()
{
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 = Red;
if (sCountry == "Japan") c = Yellow;
if (sCountry == "USA") c = White;
if (sCountry == "Germany") c = Green;
if (sCountry == "ES") c = Blue;
if (sCountry == "GB") c = Orange;
if (sCountry == "Canada") c = Gray;
if ((sCountry == "Japan") && (!Japan)) continue;
if ((sCountry == "USA") && (!USA)) continue;
if ((sCountry == "Germany") && (!Germany)) continue;
if ((sCountry == "ES") && (!ES)) continue;
if ((sCountry == "GB") && (!GB)) continue;
if ((sCountry == "Canada") && (!Canada)) continue;
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I placed file week.txt in catalog ...experts\files\week.txt
which cointaines that line..
2007.03.30;16:00;Industrial Prodaction MM;USA;March;3.40%;1.0%;
and run that file
//+------------------------------------------------------------------+
//| 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 = "week.txt";
int start()
{
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 = Red;
if (sCountry == "Japan") c = Yellow;
if (sCountry == "USA") c = White;
if (sCountry == "Germany") c = Green;
if (sCountry == "ES") c = Blue;
if (sCountry == "GB") c = Orange;
if (sCountry == "Canada") c = Gray;
if ((sCountry == "Japan") && (!Japan)) continue;
if ((sCountry == "USA") && (!USA)) continue;
if ((sCountry == "Germany") && (!Germany)) continue;
if ((sCountry == "ES") && (!ES)) continue;
if ((sCountry == "GB") && (!GB)) continue;
if ((sCountry == "Canada") && (!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);
}
//+------------------------------------------------------------------+
and nothing happens it does not work
Can someone point what is rwong with it?