- There is no debugging in mql4. All you have is Print, and logging via debug view
/** Log * send information to OutputDebugString() to be viewed and logged by * SysInternal's DebugView (free download from microsoft) This is ideal for * debugging as an alternative to Print(). The function will take up to 10 * stringa (or numeric) arguments to be concatenated into one debug message. //*/ #import "kernel32.dll" void OutputDebugStringA(string msg); #import void Log(string s1, string s2="", string s3="", string s4="", string s5="", string s6="", string s7="", string s8="", string s9="", string s10=""){ if (IsDllsAllowed()){ string out = WindowExpertName() + ": " + s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10; OutputDebugStringA(out); } }
- You can also pause the tester using
#include <WinUser32.mqh> #import "user32.dll" int GetAncestor(int, int); #import void PauseTest(){ datetime now = TimeCurrent(); static datetime oncePerTick; if( oncePerTick != now )if( IsTesting() )if( IsVisualMode() )if( IsDllsAllowed() ){ oncePerTick = now; for(int i=0; i<200000; i++){ // Delay required for speed=32 (max) if (IsStopped()) break; // https://forum.mql4.com/32837 WH-DL int main = GetAncestor(WindowHandle(Symbol(), Period()), 2);//GA_ROOT if (i==0) PostMessageA(main, WM_COMMAND, 0x57a, 0); // 1402. Pause } } // The PostMessage above sends the command to the main terminal. Thus it // only affects the active chart window. To maximize a window for example // must activate it first. https://forum.mql4.com/35336#538848 // See also SetForgroundWindow(h) https://www.mql5.com/en/code/10146 }
- I use Notepad2 for syntax highlighting. Others recommend notepad++.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Is there a way to create expert advisors in Visual Studio ?
I wish there was a plugin that allows syntax highlighting, debugging etc.
I've found some libraries which allow coding expert advisors in C#, but it's not exactly MQL.
If I choose to use C# for doing the job, which solution is the best ?
So far I've tried http://www.nquotes.net and http://tradeplatform.codeplex.com