Debugging
Hello ccie8340,
I know what you mean, but it is not possible.
There are two ways that I debug MT4 code:
1/ Use the Print() function to display output in the Terminal window.
Which is quite slow displaying output.
2/ Write the output to a file. This is very quick.
Coder
How to write output to file?
Hi Coder,
Thanks for the reply. Can you pls give an example as to how to write output of every line to a file?.
Sometimes the EA hangs the terminal, so I am trying to find out which line of code is causing that.
Thanks.
Cheers,Padhu
...Can you pls give an example as to how to write output of every line to a file?.
Here we go...
string DataFileName;
int handle;
DataFileName = ("mymt4logfile" + ".csv");
handle=FileOpen(DataFileName, FILE_CSV|FILE_WRITE, ',');
if(handle>0)
{
FileWrite(handle,"HELLO WORLD");
FileClose(handle);
}![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
If anyone has used SQL profiler, this might be familiar...Basically when the code runs, the SQL profiler spits out very detailed output of each and every line of the code operation.
Is it possible to run EA like that may be using an external var
external bool Enable_Debug_Mode = true|false
if true
then
display in the experts journal
Executing line 1
.....
Executing line 2 and so on.
Just looking for a way to troubleshoot EA.
Thanks,Padhu