Bandas de Bollinger sobre indicadores com Alerta!

 

Olá Traders!

É possível inserir um alerta ou um push de mensagem toda vez que um indicador como Momentum,RSI ou outros atravessarem uma das bandas de Bollinger?

Estou fazendo estudos em cima disso e gostaria de um apoio nesse sentido das BB sobre outros indicadores com alerta ou push.Desde já agradeço

 
//+------------------------------------------------------------------+
//|                                                       JHJ191.mq5 |
//|                        Copyright 2017, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property indicator_separate_window
#property indicator_minimum 1
#property indicator_maximum 100
#property indicator_buffers 10
#property indicator_plots   10

//---
//--- plot Label1 
#property indicator_label1  "SELL"
#property indicator_type1   DRAW_HISTOGRAM
#property indicator_color1  clrRed
#property indicator_style1  STYLE_SOLID
#property indicator_width1  3
//--- plot Label2
#property indicator_label2  "BUY"
#property indicator_type2   DRAW_HISTOGRAM
#property indicator_color2  clrBlue
#property indicator_style2  STYLE_SOLID
#property indicator_width2  3

//--- plot Label3
#property indicator_label3  "ALERT"
#property indicator_type3   DRAW_HISTOGRAM
#property indicator_color3  clrYellow
#property indicator_style3  STYLE_SOLID
#property indicator_width3  3

double         ln_sell_Buff[];
double         ln_buy_Buff[];

double         ln_alert_Buff[];

double         arr_up_Buff[];
double         arr_low_Buff[];
double         arr_md_Buff[];

double         arr_RSI_Buff[];
double         arr_CCI_Buff[];

double         arr_WPR_Buff[];

double         arr_BW_Buff[];

int d_BB; int d_CCI; int d_RSI; int d_WPR; int d_BW;
//---

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
      SetIndexBuffer(0,ln_sell_Buff,INDICATOR_DATA); //UP LRCHANNEL
      SetIndexBuffer(1,ln_buy_Buff,INDICATOR_DATA); //UP LRCHANNEL
      SetIndexBuffer(2,ln_alert_Buff,INDICATOR_DATA); //UP LRCHANNEL
      SetIndexBuffer(3,arr_up_Buff,INDICATOR_DATA); //UP LRCHANNEL
      SetIndexBuffer(4,arr_low_Buff,INDICATOR_DATA); //UP LRCHANNEL
      SetIndexBuffer(5,arr_RSI_Buff,INDICATOR_DATA); //UP LRCHANNEL
      SetIndexBuffer(6,arr_CCI_Buff,INDICATOR_DATA); //UP LRCHANNEL
      SetIndexBuffer(7,arr_md_Buff,INDICATOR_DATA); //UP LRCHANNEL
      SetIndexBuffer(8,arr_WPR_Buff,INDICATOR_DATA); //UP LRCHANNEL
      SetIndexBuffer(9,arr_BW_Buff,INDICATOR_DATA); //UP LRCHANNEL
      
     //--$lrchannel$--//
      d_BB=iCustom(NULL,0,"Examples\\BB"); 
     //--$lrchannel$--//
      d_CCI=iCustom(NULL,0,"Examples\\CCI"); 
     //--$lrchannel$--//
      d_RSI=iCustom(NULL,0,"Examples\\RSI"); 
     //--$wpr$--//
      d_WPR=iCustom(NULL,0,"Examples\\WPR"); 
      //--$WB$--//
      d_BW=iCustom(NULL,0,"Examples\\BW-ZoneTrade"); 
      
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---     
   //int lrcha;  int d_RSI;  int d_CCI;  int d_imoviment;
   //--$BB [1]$--//
   CopyBuffer(d_BB,0,0,rates_total,arr_md_Buff);
   //--$BB [2]$--//
   CopyBuffer(d_BB,1,0,rates_total,arr_up_Buff);
   //--$BB [3]$--//
   CopyBuffer(d_BB,2,0,rates_total,arr_low_Buff);
   //--$CCI [0]$--//
   CopyBuffer(d_CCI,0,0,rates_total,arr_CCI_Buff);
   //--$RSI [0]$--//
   CopyBuffer(d_RSI,0,0,rates_total,arr_RSI_Buff);
   //--$WPR[0]$--//
   CopyBuffer(d_WPR,0,0,rates_total,arr_WPR_Buff);
   //--$BW[0]$--//
   CopyBuffer(d_BW,4,0,rates_total,arr_BW_Buff);
   //---
   //--
    //--- Calcule os valores do indicador 
   int start=0; int ttl_arr_bb; 
//--- Se já foi calculado durante os inícios anteriores do OnCalculate 
   if(prev_calculated>0) start=prev_calculated-1; // definir o início do cálculo com a penúltima barra 
//--- Preencher o buffer do indicador com valores 
   for(int i=start;i<rates_total;i++) 
     { 
         if(i>4){
               /*
              if(arr_RSI_Buff[i-2]==arr_RSI_Buff[i-1] && arr_CCI_Buff[i-2]==arr_CCI_Buff[i-1] && arr_up_Buff[i-1]==arr_up_Buff[i] && arr_low_Buff[i-1]==arr_low_Buff[i]){  
                  //---
                  if(arr_RSI_Buff[i-1]<arr_RSI_Buff[i] && arr_CCI_Buff[i-1]<arr_CCI_Buff[i] && arr_up_Buff[i-1]==arr_up_Buff[i] && arr_low_Buff[i-1]==arr_low_Buff[i]){ 
                     ln_alert_Buff[i]=EMPTY_VALUE;
                     ln_sell_Buff[i]=1000;
                     ln_buy_Buff[i]=EMPTY_VALUE;
                  }else  if(arr_RSI_Buff[i-1]>arr_RSI_Buff[i] && arr_CCI_Buff[i-1]>arr_CCI_Buff[i] && arr_up_Buff[i-1]==arr_up_Buff[i] && arr_low_Buff[i-1]==arr_low_Buff[i]){ 
                     ln_alert_Buff[i]=EMPTY_VALUE;
                     ln_sell_Buff[i]=EMPTY_VALUE;
                     ln_buy_Buff[i]=1000;
                  }else{    }
                 //--- 
              }else*/
              //!= && < && == && low - up <4
              ttl_arr_bb=arr_up_Buff[i]-arr_low_Buff[i];
              if(arr_RSI_Buff[i-2]!=arr_RSI_Buff[i-1] && arr_CCI_Buff[i-2]!=arr_CCI_Buff[i-1] && arr_RSI_Buff[i-2]>arr_RSI_Buff[i-1] && arr_CCI_Buff[i-2]>arr_CCI_Buff[i-1] && arr_up_Buff[i-1]==arr_up_Buff[i] && arr_low_Buff[i-1]==arr_low_Buff[i] && tick_volume[i]>200 && ttl_arr_bb<7 && arr_BW_Buff[i]==0){ 
              //if(arr_RSI_Buff[i-2]!=arr_RSI_Buff[i-1] && arr_CCI_Buff[i-2]!=arr_CCI_Buff[i-1] && arr_RSI_Buff[i-2]>arr_RSI_Buff[i-1] && arr_CCI_Buff[i-2]>arr_CCI_Buff[i-1] && arr_up_Buff[i-1]==arr_up_Buff[i] && arr_low_Buff[i-1]==arr_low_Buff[i] && tick_volume[i]>200 && ttl_arr_bb<7){ 
               //if(arr_RSI_Buff[i-2]!=arr_RSI_Buff[i-1] && arr_CCI_Buff[i-2]!=arr_CCI_Buff[i-1]){
               //d_BW
                     ln_alert_Buff[i]=EMPTY_VALUE;
                     ln_sell_Buff[i]=1000;
                     ln_buy_Buff[i]=EMPTY_VALUE;
                     
                  //}else{}
              //!= && < && ==    
              }else  if(arr_RSI_Buff[i-2]!=arr_RSI_Buff[i-1]&&arr_CCI_Buff[i-2]!=arr_CCI_Buff[i-1] && arr_RSI_Buff[i-2]<arr_RSI_Buff[i-1] && arr_CCI_Buff[i-2]<arr_CCI_Buff[i-1] && arr_up_Buff[i-1]==arr_up_Buff[i] && arr_low_Buff[i-1]==arr_low_Buff[i] && tick_volume[i]>200 && ttl_arr_bb<7 && arr_BW_Buff[i]==1){ 
              //}else  if(arr_RSI_Buff[i-2]!=arr_RSI_Buff[i-1]&&arr_CCI_Buff[i-2]!=arr_CCI_Buff[i-1] && arr_RSI_Buff[i-2]<arr_RSI_Buff[i-1] && arr_CCI_Buff[i-2]<arr_CCI_Buff[i-1] && arr_up_Buff[i-1]==arr_up_Buff[i] && arr_low_Buff[i-1]==arr_low_Buff[i] && tick_volume[i]>200 && ttl_arr_bb<7){ 
                  //if(arr_RSI_Buff[i-2]!=arr_RSI_Buff[i-1] && arr_CCI_Buff[i-2]!=arr_CCI_Buff[i-1]){
                     ln_alert_Buff[i]=EMPTY_VALUE;
                     ln_sell_Buff[i]=EMPTY_VALUE;
                     ln_buy_Buff[i]=1000;
                     
                   //}else{ }
              //==
              }else if(arr_up_Buff[i-1]==arr_up_Buff[i] && arr_low_Buff[i-1]==arr_low_Buff[i] && ttl_arr_bb<7){ 
                  ln_alert_Buff[i]=1000;
                  ln_sell_Buff[i]=EMPTY_VALUE;
                  ln_buy_Buff[i]=EMPTY_VALUE;
                  
                  //Alert(ttl_arr_bb);
              }else{ } 
               
              //--- 
              /*
               if(arr_up_Buff[i-1]==arr_up_Buff[i] && arr_low_Buff[i-1]==arr_low_Buff[i]){ 
                  ln_buy_Buff[i]=1000;
                  ln_sell_Buff[i]=EMPTY_VALUE;
              }else{ } 
              */
             /*
              if(arr_up_Buff[i-1]==arr_up_Buff[i]}{ 
                  
              }else if(arr_low_Buff[i-1]==arr_low_Buff[i]){ 
              
              }else{ }
              */
         }   
     } 
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
Razão: