Logs a String to a File

Code in mql5:


//define parameter  
string filename; 
filename = _Symbol + "-" + IntegerToString(dt.mon) + "-" + IntegerToString(dt.day) + ".txt"; 

void Write(string str)
{
int handle;
handle = FileOpen(filename, FILE_READ|FILE_WRITE|FILE_CSV, "/t");
FileSeek(handle, 0, SEEK_END);
FileWrite(handle, str + " Time " + TimeToString(TimeCurrent(), TIME_DATE|TIME_SECONDS));
FileClose(handle);
}

No comments:

Post a Comment