Does anyone know if it's possible to program my EA to pull in data from the terminal journal (not the experts log)?
I want to do this live if possible, so check the text in the journal every tick, minute or ideally when a new journal entry appears and scan the text for certain values.
I'm not sure where the live journal text is located, or the syntax for how to read it in. I've been searching the forums for previous similar topics but haven't found anything so far.
Thanks in advance!
You could try reading in the latest log file (contains text from the journal tab). Log files are stored in your terminal folder/logs and have the extension ".log"Data is in a fixed field format so quite easy to break it down into fields eg:
1 06:48:20.509 '7494499': ping failed
1 06:48:20.511 '7494499': datacenter connecting failed 
0 06:48:21.545 '7494499': login on MetaQuotes-Demo through Access Point USA (ping: 376.80 ms)
0 06:48:24.075 '7494499': login datacenter on MetaQuotes-Demo through Access Point USA (ping: 376.80 ms)
Thanks Stuart, I'll give it a go. But how often are those log files updated? Do you know if there is a delay between journal entries appearing in the terminal and being saved to the log files?
I've never actually tried to read in an external file before. Do you have any tips to help me get started? - How do I reference a particular line in the log file once I've imported it?
Thanks for responding to my query, really appreciated!
If an alert takes place in the terminal (not driven by the EA), I want my EA to recognise it from the journal information and adjust it's actions accordingly.
I've never actually tested it but I would guess that the log file actually gets updated before the journal/expert tab. The reason I say this is that I know for a fact that if the queue of messages is too long, not everything will get printed to the tab but absolutely everything gets printed to the log. But if it's not before, it would be immediately after.
All the info you need to work with files, including examples, are in the docs and the book. There's obviously a few different ways to handle the logic of what you're trying to achieve. I'd be looking at using the file pointer, date stamp and the specific text (eg "Alert" or "Notification" etc) that you're looking for. Just check the log after the alert has triggered and you'll see what text it generates, then target that text.
Very welcome :)p.s. If you also want to check the EA journal, log files for that are under MQL/Logs
That will not work Stuart. 1° You can' use mql4 file function as the file to read are outside the MT4 sandbox, you need to use winapi functions.
2° As someone posted (he removed his message later), the date are not flushed to the log file immediately and it's very difficult to control that.
Good point about outside the sandbox mate! winapi it is.
Not sure about the flushing to the log, mine seems to be instant..?