Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

PPO_SignAlert - MetaTrader 5 Script | Forex Indicator Download - MT4/MT5 Resources

author EAcpu | 3 reads | 0 comments |

PPO_SignAlert - indicator for MetaTrader 5

PPO_SignAlert - indicator for MetaTrader 5

The semaphore-based signal indicator relatively smoothes the rate of price changes and features include sending alerts, emails and push notifications to mobile devices.

In order to implement alerts, email messages and push notifications, the following changes were made to the indicator code:

 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
  • Three new functions have been added at the end of the indicator code: BuySignal(), SellSignal() and GetStringTimeframe()
     //+------------------------------------------------------------------+
    //|Buy signal function |
    //+------------------------------------------------------------------+
    blank buy signal( string signal sir name, // Indicator name text for email and push messages double buy arrow(&B)[], // indicator buffer with buy signal constant integer rate_total, // current number of bars constant integer ex_calculation, // number of bars of the previous price move constant double & close [], // closing price constant integer &spread[]) // spread { you // --- stationary unit counter = 0 ;
    if (Rates_total!=Prev_calculated) counter = 0 ;
    
    boolean buysignal = false ;
    booleanSeriesTest = array getSeries (BuyArrow);
    integer exponent;
    if (series test) index = integer (number of items);
    Other indexes=Rates_total- integer (number of items) -1 ;
    if ( Normalized Double (BuyArrow[index], _number ) && BuyArrow[index]!= null_VALUE ) 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 += 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);
    yword">If (push) send notification (signal sir name + ": buy signal at Ask=" + ask + ", bid =" + bid + ", date =" + text + "symbol =" + symbol () + "period =" + period); } you //--- } //+--------------------------------------------------------------------------------+ // | sell signal function | //+--------------------------------------------------------------------------------+ blank sell signal ( string signal sir name, // Indicator name text for emails and push messages double sales arrow(&s)[], // indicator buffer with sell signal constant integer rate_total, // current number of bars constant integer before_calculation, // number of bars of the previous price movement constant double & close [], // closing price constant integer &spread[]) // spread { you // --- stationary unit counter = 0 ; if (Rates_total!=Prev_calculated) counter = 0 ; boolean sell signal = false ; boolean series test = array to get series (sell arrows); integer index; if (series test) index = integer (number of bars); else index = Rates_total - integer (number of bars) - 1 ; if ( normalized double (SellArrow[index], _number ) && SellArrow[index]!= null_VALUE ) SellSignal = True ; if (SellSignal && Counter <= NumberofAlerts) { Counter++; MqlDateTimeTM ; BuildTime ( timecurrent (), tm); string literal = String time ( timecurrent (), TIME_DATE ) + "" + string (tm.hour) + ":" + string (tm.minute); Series test = array to get series ( closed ); if (series test) index = integer (number of bars); other indexes = Rates_total- integer (number of bars) - 1 ; double ask = close [index]; double bid = close [index]; series test = array to get series (propagation); if (series test) index = integer (number of bars); other indexes = Rates_total- integer (number of bars) - 1 ; bid +=spread[index]; string ask= Double to String ( ask , _number ); string bid= 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 on ask=" + ask + ", bid = " + bid + ", date = " + text + " symbol = " + symbol () + " period = " + s period); if (push) send notification (signal sir name + ": Sell signal on Ask = " + ask + ", bid = " + bid + ", date = " + text + " symbol = " + symbol () + " period = " + s period); } You //--- } //+------------------------------------------------------------------+ //| Get the time range in string form | //+------------------------------------------------------------------+ String Get the string time range ( ENUM_TIMEFRAMES approximate time) { //---- return ( string substring ( enumeration to string (approximate time), 7 , - 1 )); //---- }
  • Added several calls to the BuySignal() and SellSignal() functions after the indicator calculation period in the OnCalculate() block
     you //--- buy signal( "PPO_signature" ,BuyBuffer,rates_total,prev_calculated,close,spread);
      sell signal( "PPO_signature" ,SellBuffer,rates_total,prev_calculated,close,spread); you //---
    
  • Where BuyBuffer and SellBuffer are the names of the indicator buffers used to store buy and sell signals. Due to empty values ​​in the indicator buffer must be set to zero or EMPTY_VALUE.

    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 \MQL5\Include). The use of the class "Average price series for intermediate calculations without using additional buffers" is described in detail in the article.

    The indicator was originally written in MQL4 and first published in the code base on March 8, 2008.

    PPO_SignAlert - indicator for MetaTrader 5

    Figure 1. PPO_SignAlert indicator on the chart

    PPO_SignAlert - indicator for MetaTrader 5

    Figure 2. PPO_SignAlert indicator. Generate an alert.


    Attachment download

    📎 SmoothAlgorithms.mqh (130.2 KB)

    📎 PPO_SignAlert.mq5 (14.98 KB)

    Source: MQL5 #16108

    Verification code Refresh