Loading…

Toast Notification Layer

Alert() steals focus and pauses the terminal with a modal popup for every single notification - fine for something genuinely urgent, disruptive for routine status messages a panel wants to surface without interrupting the trader. This library draws each toast as one label on a tinted background rectangle near a chart corner, and expires it on its own after a configured duration with no interaction required. There is no opacity property on an MQL4 chart object, so "auto-fade" here means the toast disappears outright once its deadline passes, not a animated fade the platform has no way to draw - the header is honest about that rather than implying a visual effect it cannot produce. A fixed pool of slots is built once at Create() time and reused for every toast pushed afterward, so Push() never calls ObjectCreate(). When every slot is occupied, a new Push() queues the toast in FIFO order instead of dropping it - Update() promotes the oldest queued toast into whichever slot next expires, so a burst of notifications larger than the visible pool is throttled to the pool's display rate rather than silently losing messages. Notes and limitations - Fixed pool of 6 visible slots and a 6-deep FIFO queue on top (both TNL_MAX_TOASTS) - a genuine flood beyond 12 pending toasts refuses further Push() calls rather than growing without bound. - No fade animation - MQL4 objects have no opacity to animate, so a toast is either fully shown or fully hidden, never partially transparent. - Update() must be called regularly (OnTick or OnTimer) for expiry and queue promotion to happen at all; the layer never advances its own state on a timer it owns. - Deadlines are tracked against GetTickCount(), so they are correct across that counter's roughly-49.7-day wraparound but are session-relative, not wall-clock - a toast's remaining time does not survive a terminal restart. - No trading and no money at risk - the demo only pushes synthetic status messages, it never sends an order.

Script · MT4 · v1.0 · Free

About Toast Notification Layer

Toast Notification Layer is a script for MetaTrader 4. It has 1 setting, such as Prefix. MQL source code included.

Files in the download: ToastNotificationLayer.mqh, ToastNotificationLayer.txt, ToastNotificationLayerDemo.mq4.

Settings

SettingDefaultWhat it does
PrefixTNLDemo_Object-name prefix for this demo's objects

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria