My notifications don't work :(

 
void SendCrossAlert()
{
  double tenkan_senValue1 = 0;
  double kijun_sen_Value1 = 0;
  double tenkan_senValue2 = 0;
  double kijun_sen_Value2 = 0;
  currenttime=Time[0];
  
  for(int i = 0;i < 300;i++)
  {
   
    double y = iBarShift(NULL,PERIOD_H1,Time[i],false);
    tenkan_senValue1 = iIchimoku(Symbol(),PERIOD_M15,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i);
    kijun_sen_Value1 = iIchimoku(Symbol(),PERIOD_M15,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i);
    tenkan_senValue2 = iIchimoku(Symbol(),PERIOD_M15,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,i + 1);
    kijun_sen_Value2 = iIchimoku(Symbol(),PERIOD_M15,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,i + 1);
    double tenkan_senAbove = iIchimoku(Symbol(),PERIOD_H1,tenkan_sen,kijun_sen,senkou_span_b,MODE_TENKANSEN,y);
    double kijun_sen_Above = iIchimoku(Symbol(),PERIOD_H1,tenkan_sen,kijun_sen,senkou_span_b,MODE_KIJUNSEN,y);
     
   
      if(upCloseArrowEnable && tenkan_senValue1 > kijun_sen_Value1 && tenkan_senValue2 <= kijun_sen_Value2 && tenkan_senAbove > kijun_sen_Above)
      
      buffer3[i] = iLow(Symbol(),PERIOD_CURRENT, i) - distance *  Point;
      if(i == 0 && IsCrossNewBar() )
      {
         if(currenttime!=candletime && i==1)
            {
               if (SendAlertByNotification) SendNotification((string)Symbol()+" M15 - Bullish TKC: " 
               + DoubleToString(iClose(Symbol(),PERIOD_CURRENT,0),Digits()));
            }
         candletime=Time[0];            
      }
     
   else if(downCloseArrowEnable && tenkan_senValue1 < kijun_sen_Value1 && tenkan_senValue2 >= kijun_sen_Value2 && tenkan_senAbove < kijun_sen_Above)
      
         buffer4[i] = iHigh(Symbol(),PERIOD_CURRENT, i) + distance *  Point;
      if(i == 0 && IsCrossNewBar())
      {
         if(currenttime!=candletime && i==1)
            {
               if (SendAlertByNotification) SendNotification((string)Symbol()+" M15 - Bearish TKC: " 
               + DoubleToString(iClose(Symbol(),PERIOD_CURRENT,0),Digits()));
            }
         candletime=Time[0];            
      }
      

This is what I have in the main function for this part of the indicator, and this is at the start in global area;

datetime candletime=0;
datetime currenttime=0;

When I remove this i get notifications every period for all pairs, and when I add this i get none. 


What is wrong with the code?

 
datetime time;

if(iTime(_Symbol,PERIOD_M1,0)!=time)
 {
 // Alert once a minute...
 time = iTime(_Symbol,PERIOD_M1,0);
 }
 
Marco vd Heijden:

I don't want a notification every period though, I only want one when the signal is made, then only another one if another signal is made...

 
Marco vd Heijden:

Also, i get the error "possible use of uninitialized variable 'time'" when i compile


 

you can of course initialize the variable yourself and of course modify the code to suit your needs.

if that is a problem you can also go here: https://www.mql5.com/en/job 

Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • www.mql5.com
Change SL and TP so they are placed with the broker and not hidden Display Panel - Add Short TP value (in same way have done Long TP) under Sup End - Change ATR SL/TP to pip values e.g. 13.9 and not 0.00139 BUILD SOMETHING GREAT WITH ONLINE DREADING (SFI), GRAW A SECOND INCOME WITH THE WORLD AFFILIATE PROGRAM....(SFI) NO RISK OF INCOME..!  ...