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

ColorJFatl_Digit_Alert - MetaTrader 5 Script - MT4/MT5 Resource

author EAcpu | 4 reads | 0 comments |

ColorJFatl_Digit_Alert - indicator for MetaTrader 5

ColorJFatl_Digit_Alert - indicator for MetaTrader 5

ColorJFatl_Digit_Alert - indicator for MetaTrader 5

This ColorJFatl_Digit indicator has the functionality of alerts, sending 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 variables for alerts
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 emails and push messages double & color array[], // color index buffer integer color index, // color index in color index buffer to generate signal constant integer rate_total, // current number of bars constant integer pre_calculation, // number of bars of the previous price move constant double & close [], // closing price constant integer & 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 ;
        }
    other {
          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 += 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+ ", dayperiod = " + text + " symbol = " + symbol () + " period = " + s period); if (push) send notification (signal sir name + ": Buy signal at Ask = " , bid =" + bid + ", date =" + text + " symbol = " + symbol () + " period = " + s period); } //--- } //+--------------------------------------------------------------------------------+ //|Sell signal function | //+------------------------------------------------------------------+ Blank Sell Signal ( Thin String Signal Mr. Name, // Indicator Name Text for Emails and Push Messages Double & Color Array[], // Color Index Buffer Integer Color Index, // Color Index in Color Index Buffer Generate Signal Constant Integer Rate_Total, // Current Bar Constant Integer Before_Calculation, // Previous Price Move Bar Constant Double & Close [], // Closing Price Constant Integer & Spread[]) // propagation { //--- static units counter = 0 ; if (Rates_total!=Prev_calculated) counter = 0 ; boolean sell signal = false ; boolean series test = array getSeries (colorarray); integer index, index 1; if (series test) { index = integer (number of bars); index 1 = index + 1 ; } else { index = Rates_total - integer (number of bars) - 1 ; Index1 = Index - 1 ; } if (ColorArray[index1]!=ColorIndex && ColorArray[index]==ColorIndex) 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 items); other index = Rates_total - integer (number of items) - 1 ; double ask = close [index]; double bid = close [index]; SeriesTest = Array Get Series (Spread); if (SeriesTest) Index = Integer (Number of Bars); Else Index = Rates_total - Integer (Number of Bars) - 1 ; Bid + = Spread [Index]; String Ask = Double to String ( Q , _Number ); String Bid = Double to String ( Bid , _Number ); String sPeriod = GetStringTimeframe( ChartPeriod ()); If (Sound On) Alert ( "Sell Signal\n Ask=" , Ask , “\nBid=" , 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 (pushed) send notification (signal sir name + ": Sell signal on Ask=" + ask + ", bid =" + bid + ", date =" + text + " symbol =" + symbol () + " period = " +s period); } //--- } //+--------------------------------------------------------------------------------+ //| Get the time range as a string | //+--------------------------------------------------------------------------------+ String Get the time range as a string ( 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
     //--- Buy signal ( “ColorJFatl_Digit_Alert” ,ColorExtLineBuffer, 2 ,rates_total,prev_calculated,close,spread);
      Sell ​​signal ( “ColorJFatl_Digit_Alert” ,ColorExtLineBuffer, 0 ,rates_total,prev_calculated,close,spread); //---
    
  • Where ColorExtLineBuffer is the name of the color index buffer used to store line colors in indexed form.

    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 the class SmoothAlgorithms.mqh library (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.

    ColorJFatl_Digit_Alert - indicator for MetaTrader 5

    Figure 1. ColorJFatl_Digit_Alert indicator on the chart

    ColorJFatl_Digit_Alert - indicator for MetaTrader 5

    Figure 2. The ColorJFatl_Digit_Alert metric generates an alert.


    Attachment download

    📎 ColorJFatl_Digit_Alert.mq5 (33.02 KB)

    📎 SmoothAlgorithms.mqh (130.2 KB)

    Source: MQL5 #16407

    Verification code Refresh