gann-hilo-swing/mql5/Indicators/GannHiLoSwing/SignalAlerts.mqh
Allan Niñal Allan Niñal f18f2ac6c1 Free source regenerated: pop-up and push on by default
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 14:28:38 +08:00
38 lines
1.9 KiB
MQL5
//+------------------------------------------------------------------+
//| SignalAlerts.mqh |
//| Copyright 2026, Allan Niñal |
//| https://www.allanninal.dev/mql5 |
//+------------------------------------------------------------------+
//| Same alert semantics as Allan's signal indicators (UT Bot, |
//| SuperTrend): one alert per closed-bar signal (pop-up, sound, |
//| push, e-mail), never during the history load, never twice for |
//| the same bar, silent in the tester. A scanner watches many |
//| symbols, so the cells that signal in the same second are sent |
//| as ONE message (push and e-mail are rate limited). |
//+------------------------------------------------------------------+
// SPDX-License-Identifier: LicenseRef-PolyForm-Noncommercial-1.0.0 (see LICENSE)
#property strict
input group "Alerts"
input bool InpAlertPopup = true; // Pop-up alert
input bool InpAlertSound = false; // Play a sound
input string InpSoundFile = "alert.wav"; // Sound file (terminal Sounds folder)
input bool InpAlertPush = true; // Push notification (set up MetaQuotes ID in Options)
input bool InpAlertEmail = false; // E-mail (set up in Options)
//--- send one message to every channel that is switched on
void SignalAlertMessage(const string product,const string msg)
{
if(MQLInfoInteger(MQL_TESTER) || msg=="")
return;
string text=product+": "+msg;
if(InpAlertPopup)
Alert(text);
if(InpAlertSound && InpSoundFile!="")
PlaySound(InpSoundFile);
if(InpAlertPush && TerminalInfoInteger(TERMINAL_NOTIFICATIONS_ENABLED))
SendNotification(StringSubstr(text,0,255));
if(InpAlertEmail && TerminalInfoInteger(TERMINAL_EMAIL_ENABLED))
SendMail(product,text);
}
//+------------------------------------------------------------------+