How to alert just once per bar?

 

Hello All,

Good afternoon!

I have the following piece of code:

      if(setalert==1 && shift==0) 

        {

               Alert(Symbol()," ",period," ",pattern);            

               setalert=0;

        }

The alert works, but every time I open the same chart time period, the alert dialog pops up again.

How can I just have the dialog open just once when hit?

Thanks,
Carlos.

Reason: