How to setup alert for only first candle.

 

Hi guys.

I want ask for help. I have indicator that alert me always on every candle when ADX main line is aiming up. Problem is that I want only alert on the first candle when this ADX is stating aiming up. I don't need it every candle because it is very annoying. Can anybody help me what I must add to the code to fix this problem?


Thanks for help.

 
int start(){
   static bool alerted = false;
   if (CONDITION){ 
      if (!alerted){ alerted = true; do whatever}
   }
   else alerted = false;
 

I will put this before this code?

// Report Output Call
void report(double pct, double treshHold, string alert, string header, string body, string mySound){
if(pct > treshHold ){
string lineId = "Daniel's PipHunter "+Time[1];

if (ObjectFind(lineId) == -1 ){
ObjectCreate(lineId,OBJ_VLINE,0,Time[1],0);
ObjectSet(lineId,OBJPROP_STYLE,STYLE_SOLID);
ObjectSet(lineId,OBJPROP_COLOR,White);

if(ShowAllert && pct > treshHold )
Alert(header);
if(SendEmail && pct > treshHold )
SendMail(header,body);
if(SoundUserAlert && pct > treshHold )
PlaySound(mySound);
}
}
}

Reason: