problem with mql4 indicator and with sendnotification

To add comments, please log in or register
valfid
48
valfid  

how come this indicator of mine has always sent me the notifications at the right time and now does not send a notification anymore? There is an error in the code or I have some blocking on the notifications according to you 


#property indicator_chart_window

datetime timeBar;
bool isNewBar;

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[])
  {
   if(Time[0]!=timeBar) isNewBar=true;
   else isNewBar=false;

   double mc1=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,1);
   double mc2=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,1); 
   double mc01=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0); 
   double mc02=iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0); 

   if(isNewBar)
     {
      if(mc1<mc2&&mc01>mc02) SendNotification(Symbol()+" TF:"+IntegerToString(Period())+" "+" buy: ");
      if(mc1>mc2&&mc01<mc02) SendNotification(Symbol()+" TF:"+IntegerToString(Period())+" "+"short: ");
      timeBar = Time[0];
     }

   return(rates_total);
  }

//+------------------------------------------------------------------+
To add comments, please log in or register