MACD Sound Indicator

 
Few days ago I made MACD Crossover alert indicator, but it won't work correctly. It shows only last few bars and line won't work correctly. I don't know how to make it work properly. Maybe someone can help me?
Files:
 

You are exiting the loop before it is complete . . .  why ?

   for(i=0; i<limit; i++) 
      {                                               //  for loop open brace . . .  where is the close brace ?
      SIGNAL_Buffer[i] = iMAOnArray(MACD_Buffer, 0, SignalEMA, 0, MODE_EMA, i);
      
      HISTOGRAM_Buffer[i] = MACD_Buffer[i] - SIGNAL_Buffer[i];
      
      
//---- done
      static int PrevSignal = 0, PrevTime = 0;
      if(SIGNAL_BAR > 0 && Time[0] <= PrevTime ) 
         return(0);                                    //  exits the for loop . . .  why  ? ? ?
      PrevTime = Time[0];   
 
RaptorUK:

You are exiting the loop before it is complete . . .  why ?

 

 


I Don't know. This where first time that I made sound alert. I Use this article for example: https://www.mql5.com/en/articles/1448
Maybe you can help me make this indicator work properly? I dont know what to change in the code.
Thx you a lot
 
takeashotlv:

I Don't know. This where first time that I made sound alert. I Use this article for example: https://www.mql5.com/en/articles/1448
Maybe you can help me make this indicator work properly? I dont know what to change in the code.
Thx you a lot
If you need someone else to fix your code for you go here:  MT4 & MT5 coding
 
takeashotlv: I Don't know. 

It's your code, you changed it, how can you not know why?

Since there are no slaves here, there are only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt and the nature of your problem. =

 
maybe you can write down what I should looking for. Maybe you can give me some links.
 
takeashotlv:
maybe you can write down what I should looking for. Maybe you can give me some links.

RaptorUK:

You are exiting the loop before it is complete . . .  why ?

This is your issue . . .  just fix it.  Don't use the existing loop for your alert,  make a new loop or use a while,  but you don't need an alert of something that happened 2 weeks ago so your loop only needs to look back a few bars . . . 
Reason: