Help how?
Help how?
What I wish to do is simply to be able to write in the output file using MQL4 file functions.
I use the following code:
I call write_data in start() function of my Indicator (or EA)
I got the comment that the file was created but in reality there is no file and the folder /expert/files remain empty.
do have an idea why the file is not created?
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[i], TIME_DATE), TimeToStr(Time[i], TIME_SECONDS),
High[i], Low[i], Close[i], Open[i], Volume[i]);
}
FileClose(handle);
Comment("File "+nameData+" has been created. "+TimeToStr(TimeCurrent(), TIME_SECONDS) );
return(0);
}
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I'm trying to write data to the output file but in vain, I dont get any error message, but there is no file created in /expert/files folder, I can't find out what is the problem.
Please help me.
thanks.