Download MetaTrader 5

Alert display at particlar date and time

To add comments, please log in or register
MQL5 language supports OpenCL. Try it!
ppapp
39
ppapp 2014.06.11 21:01 

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
9892
Rodrigo Malacarne 2014.06.12 02:15  
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 2014.06.25 06:04  

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
14884
Biantoro Kunarto 2014.06.26 04:26  
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