Download MetaTrader 5

Any way to get PRINT messages saved into logfile?

To add comments, please log in or register
Gregory
72
Gregory  

When buying/selling, i always add a "print" message to explain which open/close method was used. It is displayed in the "Experts" tab, but not in the txt log file that has a date as name.

If that is intented, it would be NICE to have print message added to log file!

THanks :) 

qjol
3243
qjol  

right click on one of the lines in Experts ---> Open and you will see it

or restart the terminal and you are gonna find it in the file

Gregory
72
Gregory  

Thanks a million Qjol !

Indeed !!! I was looking in the log folder when you do File\Open Data Folder, and there in the log file you dont have the "print" messages.... Not sure why they are two log files not with the same format !

Have a nice weekend 

Hongliang Liu
1282
Hongliang Liu  

this is my function to save to my own log file,the same parameter with print function

//+------------------------------------------------------------------+
//| Write usefull log to file                                        |
//+------------------------------------------------------------------+
void WriteToLogFile(string logstring)
{
    int handle;
    string filedatestr = "" + (string)TimeYear(TimeCurrent()) + "_" + (string)TimeMonth(TimeCurrent()) + "_" + (string)TimeDay(TimeCurrent()) + "";
    handle = FileOpen("mylog_" + filedatestr + ".txt", FILE_READ|FILE_WRITE);
    string baseinfo = TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS);
    baseinfo = baseinfo + " Balance:" + (string)AccountBalance() + " Equity:" + (string)AccountEquity() + "\nMargin:" + (string)AccountMargin() + " FreeMargin:" + (string)AccountFreeMargin() + "\n";
    if(handle > 0)
    {
        FileSeek(handle, 0, SEEK_END);
        FileWrite(handle,baseinfo,logstring);
        FileClose(handle);
    }
}

 FYI

To add comments, please log in or register