elanin:
I can not get Alert or PlaySound working when running my EA code in tester.
Print command does work in Journal, but with lag and I prefer popup alert to troubleshoot my code.
Any suggestion what should I try?
You should try reading this: Testing Features and Limits in MetaTrader 4
And you could consider using Comment() or my CommentLab() code.
RaptorUK: And you could consider using Comment() or my CommentLab() code.
Or DBGview and my Log() function or https://www.mql5.com/en/forum/142787
Did you mean this ? https://www.mql5.com/en/forum/142787
The offered solutions are way too complicated. Things are more simple:
#import "user32.dll" int MessageBoxA(int hWnd, string lpText, string lpCaption, int style); #import "winmm.dll" bool PlaySoundA(string lpSound, int hMod, int fSound); #import #define MB_OK 0x00000000 #define SND_ASYNC 0x01 // play asynchronously #define SND_FILENAME 0x00020000 // parameter is a file name /** * Force playback of a sound even if not supported by MT4. * * @param string soundfile */ void ForceSound(string soundfile) { if (!IsTesting()) PlaySound(soundfile); else PlaySoundA(StringConcatenate(TerminalPath(), "\\sounds\\", soundfile), NULL, SND_FILENAME|SND_ASYNC); } /** * Force an alert even if not supported by MT4. * * @param string message */ void ForceAlert(string message) { if (!IsTesting()) { Alert(message); } else { ForceSound("alert.wav"); MessageBoxA(NULL, message, "Alert", MB_OK); } }
paulepanke:
Comment() is too complicated ? ?
The offered solutions are way too complicated. Things are more simple:
elanin: ... I prefer popup alert to troubleshoot my code.
RaptorUK: Comment() is too complicated ??
Yes, too complicated as a popup replacement. Furthermore, Comment() doesn't work at all if VisualMode=Off.
![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
I can not get Alert or PlaySound working when running my EA code in tester.
Print command does work in Journal, but with lag and I prefer popup alert to troubleshoot my code.
Any suggestion what should I try?