alert when bar color changes

 

hi forum,

can somebody please help me with that problem?

i use heiken ashi charts and i want to see an alert when the bar color changes.

for example: if (close(2)>open(2) && close(1)<open(1)) alert ("test");

but i want to see the alert only one time. i tried to program it with an alert-tag but i see the alert more than one time.

can somebody please help me?

thanks!!!!!

 
double alertTag;
if (close(2)>open(2) && close(1)<open(1) && alertTag!=Time[0]){
   Alert ("test");
   alertTag=Time[0];
}
This will give you alert only once per bar, but if on next bar open rule for alert is still true it will gives you alert again on so on.
 
great, thank you!!!