Notification Deduplicator
The usual guard against notification spam is a single "no more than one alert per N seconds per topic" cooldown timer, and it has an obvious failure mode: it suppresses a genuinely NEW message just because an unrelated OLD one under the same topic fired recently. A "spread widened" alert on EURUSD ten seconds before a real "stop loss hit" alert on the same symbol would silence the stop-loss alert too, under a plain per-topic timer - exactly the message a trader least wants dropped. This header fingerprints the actual message text (a cheap FNV-1a 32-bit hash, not a full copy of every string ever sent) alongside the topic key. NdShouldNotify() only suppresses a call when BOTH the key and the content match the last recorded notification for that key AND the window has not yet elapsed - a change in content resets the window immediately regardless of timing, and a change in topic key is independent from the start. The registry tracks up to 64 distinct topic keys and evicts the oldest-sent one once full, rather than silently refusing to track any more topics past that cap. Notes and limitations - Fixed registry of NDD_MAX_KEYS (64) distinct topic keys; once full, the oldest-sent key is evicted to make room for a new one, so a program cycling through more than 64 rotating keys (e.g. one per symbol on a very large watch list) can lose dedup history for a topic that has been quiet a while. - The fingerprint is a 32-bit non-cryptographic hash (FNV-1a) - a collision would incorrectly suppress an unrelated message with the same key, which is a low-probability false negative for spam suppression, not something this library defends against as an adversarial input. - Purely in-memory - a restart of the EA/script/indicator forgets every topic's history, which is the correct behaviour for a "since this run started" dedup tool but means it does not persist suppression state across terminal restarts. - This header decides whether to notify; it does not send anything itself - the caller still calls Alert()/Print()/SendNotification()/ SendMail() etc. only when NdShouldNotify() returns true.
Script · MT5 · v1.0 · Free
About Notification Deduplicator
Notification Deduplicator is a script for MetaTrader 5. It has 1 setting, such as Window seconds. MQL source code included.
Files in the download: NotificationDeduplicator.mq5.mqh, NotificationDeduplicator.txt, NotificationDeduplicatorDemo.ex5, NotificationDeduplicatorDemo.mq5.
Settings
| Setting | Default | What it does |
|---|---|---|
| Window seconds | 5 | dedup suppression window in seconds |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 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 · EURUSD · MT5 Script · MQL5 Source Code