Alert Sound Pack Verifier
PlaySound(filename) looks for its file in the terminal's real Sounds folder. If the file is not there - a typo, a sound that never got copied over after a terminal reinstall, a custom pack that was only half-copied - PlaySound simply does nothing. No error dialog, no log line, nothing. The first time anyone notices is when a real trading alert should have played and did not. MQL4's own file-checking functions cannot help here directly: they are sandboxed to MQL4\Files, and the terminal's Sounds folder sits alongside MQL4, not inside it, so nothing in a script can ask the real Sounds folder "does this file exist" the normal way. This tool works around that gap in two steps. First, and reliably, it checks a MIRRORED copy of your sound pack that you place under MQL4\Files - a folder you keep in sync with the real Sounds folder purely for this kind of check - and reports which names are present there and their size. Second, optionally, it also calls PlaySound() on each name against the real Sounds folder and logs GetLastError() straight afterwards. That second check is a weak signal only: MQL4 gives no dedicated "sound file not found" error code, so a clean GetLastError() after PlaySound does not prove the file played, only that the API call itself did not fail outright. The mirror check is the part of this tool that actually proves presence. Notes and limitations - The mirror-folder check is the only genuinely reliable part of this tool. MQL4's file API cannot see the real Sounds folder at all, so keeping the mirror in sync with it is a manual step and the honest price of checking anything at all. - A clean (zero) GetLastError() after PlaySound() does not prove the file existed or played - MQL4 documents no dedicated error code for a missing sound file, so this check can only catch API-level failures, not a silently-ignored missing file. - This tool never modifies, deletes or copies any sound file; syncing the mirror folder with your real Sounds folder is left to you. - Only filenames, not full paths, are supported, matching how PlaySound() itself is normally called.
Script · MT4 · v1.0 · Free
About Alert Sound Pack Verifier
Alert Sound Pack Verifier is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 3 settings, such as Mirror subfolder, Also test play and Play delay ms. MQL source code included.
Files in the download: AlertSoundPackVerifier.mq4, AlertSoundPackVerifier.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Mirror subfolder | SoundPackCheck | Subfolder under MQL4\Files holding a copy of the same sound pack, for a real existence check |
| Also test play | true | Also call PlaySound() on each entry against the real terminal Sounds folder |
| Play delay ms | 400 | Pause between test plays so short sounds do not cut each other off |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT4 Script · MQL4 Source Code