alert iterations - page 2

 
GarF1eld:

You're welcomed.

Good luck

GarF1eld,

I have used the code you suggested and it works to make the alert happen once, but it never alerts again. I want it to alert once everytime the criteria is met...the code makes it alert once and never again on that pair. how do I make it alert only once every time the criteria is met??


Please help, thanx.

 

When the condition is NOT met, reset the flag.

if(ConditionForAlert == True AND AlreadyAlertedFlag==False){
   Alert(...);
   AlreadyAlertedFlag = true;

}

if(ConditionForAlert == false AND AlreadyAlertedFlag==True){
   AlreadyAlertedFlag = false;

}
 
GarF1eld:

if you would just paste that code in your EA, it wouldnt work :D


declare firstTime as a global variable. and

put into the init() function.



why firstTime variable has to be in init() function?
 
01005379:
why firstTime variable has to be in init() function?

I don't think it does. It can be declared either static inside start or on the global scope. Anything in init() for this variable is superfluous

V

 
Viffer:

I don't think it does. It can be declared either static inside start or on the global scope. Anything in init() for this variable is superfluous

V

Thanks!
 

Help me to find please the indicator sounding on each of ticks

 

 
bool running=true;


while (running)
   {
   PlaySound ("Alert.wav");
   }
Reason: