MetaTrader is "sandboxed" and only allows the function PlaySount() to access sound files in its designated directory (and subdirectories): "<terminal_directory>\Sounds".
EDIT: Corrected the above file location!
![PlaySound - Common Functions - MQL4 Reference PlaySound - Common Functions - MQL4 Reference](https://c.mql5.com/36/61/playsound-common-functions-mql4.png)
- docs.mql4.com
MetaTrader is "sandboxed" and only allows the function PlaySount() to access sound files in its designated directory (and subdirectories): "<Data Folder>\Sounds".
MetaTrader is "sandboxed" and only allows the function PlaySount() to access sound files in its designated directory (and subdirectories): "<terminal_directory>\Sounds".
EDIT: Corrected the above file location!
Ok, so basically I'd have to manually put the sounds I want in that folder, it sounds like...?
You can also put your .wav files into the \MQL4\Files\ folder
if ( !PlaySound("\\Files\\sound.wav") ) { Print("PlaySound() failed to play the sound file."); }
Sweet, thanks! I'll look into that.
Strangely now though, my sounds are still playing even after I remove them from the data folder Sounds folder, so I can't test the method you share here.
![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
Hi all!
I'm trying to use the PlaySound() function, and my EA is grabbing the sound files from my MT4 install's data folder. There are somehow a couple of files in that folder, but the ones I want are in the MT4 application folder in Program Files (x86).
How can I get my EA to look in the latter instead of the former?