Waddah_Attar_Trend_Alert - MetaTrader 5 Script - MT4/MT5 Resources



Real author: Engineer. wada attar
Waddah_Attar_Trend Indicator has alert, email and push notification capabilities.
In order to implement alerts, email messages and push notifications, the following changes were made to the indicator code:
//----Alert input Input unit number = 1 ; //The number of bars of the signal Input boolean sound on = true ; //enable alert Input unit alarm number = 2 ; //Alarm number input boolean email-on = false ; //enable mailing signal input boolean pressed = false ; //enable signaling to mobile devices
//|Buy signal function |
//+------------------------------------------------------------------+
Blank buy signal( string signal sir name, // indicator name text for emails and push messages
Double & color array[], // color index buffer
Integer color index, // Color index in the color index buffer used to generate the signal
Constant integer rate_total, // current number of bars
Constant integer BEFORE_CALCULATION, // number of bars of the previous price change
const double & close [], // closing price
const int & spread[]) // spread
{
//---
static unit counter = 0 ;
if (Rates_total!=Prev_calculated) counter = 0 ;
boolean buysignal = false ;
booleanSeriesTest = array getSeries (ColorArray);
integer index, index 1;
if (series test)
{
Index = integer (number of items);
index1=index+ 1 ;
}
Others
{
Index=Rates_total- integer (number of items) -1 ;
index1=index- 1 ;
}
if (ColorArray[index1]!=ColorIndex && ColorArray[index]==ColorIndex) BuySignal= true ;
if (BuySignal && counter<=NumberofAlerts)
{
counter++;
MqlDateTimeTM ;
BuildTime ( timecurrent (),tm);
string literal = string time ( timecurrent (), TIME_DATE ) + "" + string (tm.hour) + ":" + string (tm.minute);
SeriesTest = arrayGetSeries ( close );
if (series test) index = integer (number of items);
Other indexes=Rates_total- integer (number of items) -1 ;
double question = close [index];
double bid = close [index];
SeriesTest = arrayGetSeries (spread);
if (series test) index = integer (number of items);
Other indexes=Rates_total- integer (number of items) -1 ;
bid += _views *spread[index];
Thin string question = double to string ( question , _number );
stringbid = double to string ( bid , _number );
String sPeriod=GetStringTimeframe( ChartPeriod ());
if (sound on) alert ( "buy signal\n ask=" , ask , "\n bid=" , bid , "\n current time=" , text, "\n symbol=" , symbol (), "period=" ,s period);
if (email) send mail (signal sir name + ": buy signal alert" , "buy signal at inquiry =" + ask + ", bid =" + bid + ", date = " + text + " symbol = " + symbol () + " period = " + s period);
if (push) send notification (signal sir name + ": Buy signal at Ask=" + ask + ", bid = " + bid + ", date = " + text + " symbol = " + symbol () + " period = " + s period);
}
//---
}
//+------------------------------------------------------------------+
//|Sell signal function |
//+------------------------------------------------------------------+
Blank sell signal( string signal sir name, // indicator name text for emails and push messages
Double & color array[], // color index buffer
Integer color index, // Color index in the color index buffer used to generate the signal
Constant integer rate_total, // current number of bars
Constant integer BEFORE_CALCULATION, // number of bars of the previous price change
const double & close [], // closing price
const int & spread[]) // spread
{
//---
static unit counter = 0 ;
if (Rates_total!=Prev_calculated) counter = 0 ;
boolean sell_signal = false ;
booleanSeriesTest = array getSeries (ColorArray);
integer index, index 1;
if (series test)
{
Index = integer (number of items);
index1=index+ 1 ;
}
Others
{
Index=Rates_total- integer (number of items) -1 ;
index1=index- 1 ;
}
if (ColorArray[index1]!=ColorIndex && ColorArray[index]==ColorIndex) sell signal= true ;
if (SellSignal && counter<=NumberofAlerts)
{
counter++;
MqlDateTimeTM ;
BuildTime ( timecurrent (),tm);
string literal = string time ( timecurrent (), TIME_DATE ) + "" + string (tm.hour) + ":" + string (tm.minute);
SeriesTest = arrayGetSeries ( close );
if (series test) index = integer (number of items);
Other indexes=Rates_total- integer (number of items) -1 ;
double question = close [index];
double bid = close [index];
SeriesTest = arrayGetSeries (spread);
if (series test) index = integer (number of items);
Other indexes=Rates_total- integer (number of items) -1 ;
bid += _views *spread[index];
Thin string question = double to string ( question , _number );
stringbid = double to string ( bid , _number );
String sPeriod=GetStringTimeframe( ChartPeriod ());
if (sound on) alert ( "sell signal\n ask=" , ask , "\n bid=" , bid , "\n current time=" , text, "\n symbol=" , symbol (), "period=" ,s period);
if (email) send mail (signal sir name + ": sell signal alert" , "sell signal in ask=" + ask + ", bid = " + bid + ", date = " + text + " symbol = " + symbol () + " period = " + s period);
if (push) send notification (signal sir name + ": sell signal at Ask=" + ask + ", bid =" + bid + ", date = " + text + " symbol = " + symbol () + " period = " + s period);
}
//---
}
//+------------------------------------------------------------------+
//|Get the time range in string form |
//+------------------------------------------------------------------+
String gets string time range ( ENUM_TIMEFRAMES approximate time)
{
//----
Return ( string substring ( enumeration to string (approximate time), 7 ,- 1 ));
//----
}
Buy signal ( “Waddah_Attar_Trend_Alert” ,ColorIndBuffer, 0 ,rates_total,prev_calculated,close,spread);
Sell signal ( “Waddah_Attar_Trend_Alert” ,ColorIndBuffer, 1 ,rates_total,prev_calculated,close,spread);
//---
where ColorIndBuffer is the name of the color index buffer used to store the line color as an index, and 0 and 1 are the number of colors in the color index buffer.
It is assumed that the only calls to the BuySignal() and SellSignal() functions will be used in the OnCalculate() block of the indicator code.
The indicator uses SmoothAlgorithms.mqh library class (copy it to

Figure 1. Waddah_Attar_Trend_Alert indicator on the chart
Figure 2. Waddah_Attar_Trend_Alert indicator. Generate alert
Attachment download
📎 SmoothAlgorithms.mqh (130.2 KB)
📎 Waddah_Attar_Trend_Alert.mq5 (27.15 KB)
Source: MQL5 #16832
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •