Sound Sequence Composer
Calling PlaySound() directly from every signal check that fires in the same tick overlaps audio and treats a routine entry alert the same as a margin call warning. Neither problem is solved by simply muting sound outside trading hours, because some alerts genuinely need to break through - a stop-out or a connection loss should still be heard at 3am even when routine signal chimes should not. This header collects sound requests into a small priority queue instead of playing them immediately. SscQueueSound takes a filename, a priority (higher plays first, ties resolve first-queued-first-played), and an urgent flag. SscProcessQueue is called once per poll (typically from OnTick or a timer) and plays at most one sound - the highest-priority entry that is currently allowed to play - then removes it from the queue. Non-urgent entries during a configured quiet-hours window are skipped and held for later rather than dropped, so nothing queued during quiet hours gets silently lost; urgent entries bypass the quiet-hours check entirely. Notes and limitations Fixed capacity of 32 queued entries (SSC_MAX_QUEUE) - SscQueueSound returns false without adding once full, it never overflows. SscProcessQueue plays at most one sound per call by design, so a caller that never polls (never calls it from OnTick/OnTimer) will accumulate a queue that never plays. Quiet hours use the platform's server time via TimeCurrent()/TimeHour(), not the local machine's clock or the trader's own timezone - align the configured hours with the broker's server time. PlaySound() itself is fire-and-forget in MQL4: there is no way to detect whether the sound file actually exists or played successfully, and MQL4's file-sandbox functions cannot see the terminal's real Sounds folder to verify a filename in advance, so a typo'd filename fails silently exactly as PlaySound() always does.
Script · MT4 · v1.0 · Free
About Sound Sequence Composer
Sound Sequence Composer is a script for MetaTrader 4. It has 2 settings, such as Quiet start hour and Quiet end hour. MQL source code included.
Files in the download: SoundSequenceComposer.mqh, SoundSequenceComposer.txt, SoundSequenceComposerDemo.mq4.
Settings
| Setting | Default | What it does |
|---|---|---|
| Quiet start hour | 22 | quiet hours begin (server time, 0-23) |
| Quiet end hour | 7 | quiet hours end (server time, 0-23) |
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: Buy/Sell Arrows · Alerts · Time Filter · MT4 Script · MQL4 Source Code