Download MetaTrader 5

Alert display at particlar date and time

To add comments, please log in or register
ppapp
39
ppapp  

Can anyone help with a simple sode that can dsiplay an alert on the main window when a particular variable date and time is reached.

Have tried doing this but sometimes the pauses between ticks are longer than the second of the particular time needs to have the Alert displayed.

 Is there a code that the Alert can be displayed when the terminal time reaches  say 2014.06.12 09:00:00?

 

TIA

Rodrigo Malacarne
Moderator
10383
Rodrigo Malacarne  
ppapp:

Can anyone help with a simple sode that can dsiplay an alert on the main window when a particular variable date and time is reached.

Have tried doing this but sometimes the pauses between ticks are longer than the second of the particular time needs to have the Alert displayed.

 Is there a code that the Alert can be displayed when the terminal time reaches  say 2014.06.12 09:00:00?

 

TIA

datetime varDate = D'2014.06.12 09:00:00';
//---
if(TimeCurrent()>=varDate)
  {
   Alert("Hey, current date is higher or equal than June 12th, 2014 09:00:00!");
  }
ppapp
39
ppapp  

Thank you.

is there a way of the Alert to occurring just once and stop once the current time has surpassed the  varDate time as there is a continuous loop to check times which include time already passed?

Biantoro Kunarto
17369
Biantoro Kunarto  
datetime varDate = D'2014.06.12 09:00:00';
static bool FirstAlert = false;
if(TimeCurrent()>=varDate && FirstAlert == false)
  {
   Alert("Hey, current date is higher or equal than June 12th, 2014 09:00:00!");
   FirstAlert = true;
  }
To add comments, please log in or register