How to alert only at candle close

camisa
587
camisa  

Hi, can someone tell me the code so the simple example indicator I attach only issues an alert after the close of the candle if the signal stays valid and not keep alerting during the duration of the candle???

Thanks!

Files:
alerta.mq4 4 kb
eli
610
eli  
camisa:
Hi, can someone tell me the code so the simple example indicator I attach only issues an alert after the close of the candle if the signal stays valid and not keep alerting during the duration of the candle??? Thanks!

The idea is to find out if there is a new bar. we can doing that by comparing the current bar time with a time that we save.

here is the code for this routine

bool NewBar()

{

static datetime dt = 0;

if (Time[0] != dt)

{

dt = Time[0];

return(true);

}

return(false);

}

Now before we check our condition we can check if the bar has changed. Something like that

i=Bars-counted_bars; // your original line of code

if (!NewBar()) // Check if new bar occurs

return(0);

while(i>=0) // your original line of code

camisa
587
camisa  

thanks a lot for the code!!!!!

jayzee
10
jayzee  

Is it possible to alert when closed price >= X value

Hi ,

Let say on 1 hour chart,

Is it possible to do a alert when closed price >= X value .

Is there any existing indicator that do such function?

jayzee
10
jayzee  

Hello,

Would you mind post the new .mq4 with the modified code?

*sorry, i am still learning *

Sergey Golubev
Moderator
120248
Sergey Golubev  

I moved your post to this thread - some indicator was posted and may be it is what you are looking for.