Metatrader Alert Bug

 

Hi,


I would like to know if someone else had already encounter the same "bug" as me.


I have an indicator with a pop up alert showing up when the conditions are met. Since the indicator also show me the past, at first, I had all the alerts showing up at once when I first started the indicator. To avoid this and to be sure that the indicator will only show an alert when the next crossover happens, I thought of the following :


-------------------------------------


int startind = 1;


int init(){

startind = 1;

}


int start(){


for(...){

if(conditions are met && startind = 0)

alert pop up

}

startind = 0;

}


---------------------------------


My problem is that, sometimes, when I switch between timeframes, the indicator display a popup alert with all the past alerts instead of just the futur ones. If I understand well, the init function should be exectuded every time I switch timeframe and so my code should prevent me of seeing all the alerts. Is there a bug in MetaTrader ? Why the init function isn't executed every time ? Is there another way to prevent all the alerts to show up ?


Thanks.


PS : I don't have the source code right now - that's why I only posted this.