I came across this indicator from http://articles.mql4.com/440
As I understand it is supposed to save live data in a .txt file. So... I attached this indicator to a chart and there appears comment "File USDJPY.txt has been created.....". But I can't find USDJPY.txt file anywhere... (it should be in experts/files, but that folder is empty) (tester/files in empty as well)
Help me!
I have same problem for this EA http://www.brokenpatterns.com/articles/mql4-export.html
As I understand it is supposed to save live data in a .txt file. So... I attached this indicator to a chart and there appears comment "File USDJPY.txt has been created.....". But I can't find USDJPY.txt file anywhere... (it should be in experts/files, but that folder is empty) (tester/files in empty as well)
Help me!
Inserted Code
#property indicator_chart_window
extern int length = 100; // The amount of bars sent to be processed
double ExtMap[]; // Chart buffer
string nameData;
int init()
{
nameData = Symbol()+".txt"; // name of the data file to be sent
return(0);
}
int start()
{
static int old_bars = 0; // remember the amount of bars already known
if (old_bars != Bars) // if a new bar is received
{
write_data(); // write the data file
}
old_bars = Bars; // remember how many bars are known
return(0);
}
//+------------------------------------------------------------------+
void write_data()
{
int handle;
handle = FileOpen(nameData, FILE_CSV|FILE_WRITE,';');
if(handle < 1)
{
Comment("Creation of "+nameData+" failed. Error #", GetLastError());
return(0);
}
FileWrite(handle, ServerAddress(), Symbol(), Period()); // heading
FileWrite(handle, "DATE","TIME","HIGH","LOW","CLOSE","OPEN","VOLUME"); // heading
int i;
for (i=length-1; i>=0; i--)
{
FileWrite(handle, TimeToStr(Time, TIME_DATE), TimeToStr(Time, TIME_SECONDS),
High, Low, Close, Open, Volume);
}
FileClose(handle);
Comment("File "+nameData+" has been created. "+TimeToStr(TimeCurrent(), TIME_SECONDS) );
return(0);
}