Looks interesting ... will it work when using the Strategy Tester?
impossible de compiler votre <debug_inc.mqh>
Why using an external tool, when the IDE now has a built in debugger?
eddie:
Why using an external tool, when the IDE now has a built in debugger?
I find it to be a more convenient way to view the logs.
OK - than i think you never used breakpoints.
eddie:
OK - than i think you never used breakpoints.
In the MT4 version I used it is not possibe to have breakpoints in the tester and I mainly debug and test while using the strat tester. So I need to use log lines for debugging.
Yes, if I could use breakpoints, I would have no need for this..
Quintos:
Hi,
Hi,
I am using this successfully on Windows 7 but on Windows 10 x64 I get an error:
Cannot call 'kernel32.dll::OutputDebugStringW', 'kernel32.dll' is not loaded
Does anyone know how to fix this?
thanks!
This may be necroing this post, but in case someone else comes across this: I put the full path in - "#import "C:\Windows\System32\kernel32.dll".
HTH!
Quintos: In the MT4 version I used it is not possibe to have breakpoints in the tester
DebugView was necessary before the built-in debugger in the editor (not the tester).

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
You can download Debug view from Microsoft to externalise anything in your code to help debug it . I have learned a great deal about MT4 from using this tool simply to output the results of some code so I understand what it is doing . For example you may see some code that you do not understand but can output parts of it and keep a track of what each calculation does ..essentially slowing it down to understand.
I adapted this from somebody else who wrote log( " " ) so thank you to that person. I have since created some new functions to make it easier to control what I see .
Process-
## IMPORTANT NOTE ##
Please test this in a DEMOtrade account until you understand what is happening .
STEP 1) download the debug view program above
STEP 2) Insert this MT4 code below in your MT4 meta editor and save it in your "INCLUDE" folder.
STEP 3) cut and past this demo EA to meta editor,save it to Expert adviser folder and run compile, this helps understand how to use log functions
STEP 4 - Find The EA you just saved and drag it onto a blank worksheet chart
STEP 5 - Open the debug view program you downloaded in earlier steps
STEP 6 - you should now see demonstration of the log showing text and EA functions like Symbol() and OrdersTotal() .
STEP 7 - Open a position ( if you don't ) and see the OrdersTotal() change showing how many orders you have open.
STEP 8 - with any new EA you build at the top place this code at the start of the EA
#include <debug_inc.mqh>
This adds the debug functions to you ea code and now you can use the functions in such as loga( " ");, logt1("..") etc ;
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Below is an example showing debug view in action ..
Here I calculate my open positions maximum profit and maximum loss amounts, and the ratio,
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Notice in the EA posted .. OrdersTotal() function even counts pending orders ( something I was made aware of by using this log function )
Hope this helps people ... let me know of any better ideas .