I've written an EA (with help of existing code I have found on the forum and the net) that reads in information from the experts log file.
However, I need the information in real time, and the log file is only updated in intervals throughout the day I think, when the terminal is closed, or when you right click on the log in the terminal and click open.
I've found this piece of code someone has written - https://www.mql5.com/en/forum/131720 - to perform a similar task where it accesses the terminal journal - repeatedly opening and closing the file to update it.
Does anyone know how I can modify this to perform the same task with the experts log file? (rather than the journal)
This is my first time using these dll functions. I'm guessing it's in the "PostMessageA(hwnd,WM_COMMAND ,33101,0);" part, but I don't understand how it can know where the journal is from this command.
Any help would be massively appreciated! Thanks in advance!
Try to replace PostMessageA(..) by PostMessageW(..)
Just tried this and it's still opening and closing the journal, rather than the experts log. I need to it open and close the experts log file instead.
Forgot to mention I had to amend the code above to change the FindWindowA to FindWindowW in order to get it to work, the FindWindowA was giving an error.
Does anyone know how to tell it to look for the experts log instead?

- msdn.microsoft.com
You can use Spy++ or similar utility to monitor system messages between windows and catch command number you need.
Hi Stanislav,
Thank you for responding. Unfortunately I don't have any experience with Visual Studio or the programming that would be required for Spy++. I'm having a look into it now though to see if it something that I could pick up easily.
Please could you elaborate on how this would work? What is the catch command number, is that the "33101"? If so, I'll still need to find the command number for the experts log.
Thanks.
Hi Stanislav,
Thank you for responding. Unfortunately I don't have any experience with Visual Studio or the programming that would be required for Spy++. I'm having a look into it now though to see if it something that I could pick up easily.
Please could you elaborate on how this would work? What is the catch command number, is that the "33101"? If so, I'll still need to find the command number for the experts log.
Thanks.
I know this is an old thread, but there was an unanswered question in it that I know the answer to. FindWindowA vs FindWindowW: Two versions of the same function. One uses ANSI strings and the other uses Unicode strings. The "W" stands for "Wide". The version you have to use depends on the coding environment making the call. I believe MT4 used to use ANSI strings but now uses Unicode strings. The documentation for these Windows functions can be found on MSDN at https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-findwindowa
I am also needing to read the journal live from an EA. Trying to get around the random bug where signals don't reliably copy due to the symbol names randomly failing to be translated. All the signal's trades are logged directly to the journal, along with the copy failure errors. My investigative work reveals that the journal contents are written to a Windows ListView control buried three child windows down (MT4\Terminal\Terminal\SysListView32). This means it should be readable live using the Windows ListView control messages. But coding MT4 for this could get a little complicated (if it's capable).

- 2018.10.05
- windows-sdk-content
- docs.microsoft.com
To open experts log file you must change from 33101 to 35435 in line
PostMessageW(hwnd,WM_COMMAND ,33101,0); // open the folder contains the log files
I have met the same problem too. So i come to give my thanks to all the authors above!
Besides, i have made a little adjustment to the EA log refreshing codes. complete version is below:
void Log_Flush(int flag) //flag 33101=sys_log 35435=mql_log { int hwnd = GetAncestor(WindowHandle(Symbol(),Period()),2); // find the Terminal handle no. PostMessageW(hwnd,WM_COMMAND,flag,0); // open the folder contains the log files Sleep(100); //----- bool check = FindIfDirOpened(); //check if the folder opened. while(check==false) check = FindIfDirOpened(); //keep checking until the open folder found while(FindIfDirOpened()) PostMessageW(FindIfDirOpened(), WM_CLOSE, 0, 0); //keep closing until the open folder closed } int FindIfDirOpened() { string log = "logs"; string i; int handle = FindWindowW(i ,log); return(handle); }
this method may not be the best, though, it is practicable.
I have met the same problem too. So i come to give my thanks to all the authors above!
Besides, i have made a little adjustment to the EA log refreshing codes. complete version is below:
this method may not be the best, though, it is practicable.
Is it possible to place order from reading the log file?
Of course.
But why.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I've written an EA (with help of existing code I have found on the forum and the net) that reads in information from the experts log file.
However, I need the information in real time, and the log file is only updated in intervals throughout the day I think, when the terminal is closed, or when you right click on the log in the terminal and click open.
I've found this piece of code someone has written - https://www.mql5.com/en/forum/131720 - to perform a similar task where it accesses the terminal journal - repeatedly opening and closing the file to update it.
Does anyone know how I can modify this to perform the same task with the experts log file? (rather than the journal)
This is my first time using these dll functions. I'm guessing it's in the "PostMessageA(hwnd,WM_COMMAND ,33101,0);" part, but I don't understand how it can know where the journal is from this command.
Any help would be massively appreciated! Thanks in advance!
( *edit - updated the code below to use PostMessageW and FindWindowW instead of PostMessageA and FindWindowA... though I'm not sure what the difference is between these two and what they actually do!... )