Hello All
Is there any way to write a indicator in MQ4 which will just alert once per bar on a cross. I am writing a indicator to alert me when a oscillar is crossing up or down on 50 just once is it every possible. I am lost.
Would be really nice if you can help me with an examplz
I am struck on this for days.
Please help
Regards
Adler
adler2,
You may try something this:
bool NewBar()
{
static datetime lastbar;
datetime curbar = Time[0];
if(lastbar!=curbar)
{
lastbar=curbar;
return (true);
}
else return(false);
}
if(NewBar())
{
if(your conditions here)
{
Alert("Signal alert");
}
}
adler2,
You may try something this:
bool NewBar()
{
static datetime lastbar;
datetime curbar = Time[0];
if(lastbar!=curbar)
{
lastbar=curbar;
return (true);
}
else return(false);
}
if(NewBar())
{
if(your conditions here)
{
Alert("Signal alert");
}
}
Thanks mate, much appreciated seems to work, thanks

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello All
Is there any way to write a indicator in MQ4 which will just alert once per bar on a cross. I am writing a indicator to alert me when a oscillar is crossing up or down on 50 just once is it every possible. I am lost.
Would be really nice if you can help me with an examplz
I am struck on this for days.
Please help
Regards
Adler