How can I get ALERT only once?

 

Hello

Let's say I want to create an alert for a condition such that for example Close[0] > 1.2800 & Close[0] < 1.2810. As you can see the alert will continue pop up as the conditions still arise which is kind of annoying. I tried to add a counter to only alert once but did not succeed.

if(Close[0] > 1.2800 & Close[0] < 1.2810 5)

{

if(AlertCount == 0)

{

Alert(Symbol(), "Advice");

AlertCount = 1;

}

}

Please help me.

 

TimeStamps works best. Try searching for TimeStamps.

Use the SRC button above when you paste code. 

Something like:

static datetime TimeStamp;
if(TimeStamp != Time[0])
{
Alert(Symbol(), "Advice");
AlertCount = 1;
TimeStamp = Time[0];
}
 

u should use a global variable for AlertCount

 
ubzen:

TimeStamps works best. Try searching for TimeStamps.

Use the SRC button above when you paste code.

Something like:

It worked, thanks.
 
mostashar15:
It worked, thanks.
Can you repost the working indicator? Thanks...
Reason: