Finding bar by time

To add comments, please log in or register
peterpies
33
peterpies  

Hi

How would you find a bar by a certain time for today

Found this in the documentation,

datetime date1 = D'2016.09.02 23:55';

But how do you use current day?

Thanks for any help or pointers where or what I need to look at
MThomp
213
MThomp  
Have you any code? At present you are defining this link https://docs.mql4.com/dateandtime.
Keith Watford
Moderator
18349
Keith Watford  
  datetime timeNow=TimeCurrent();
  datetime midnight_today=timeNow-(timeNow%86400);
  //Find time for 10:55 today
  int secs=10*60*60; //seconds for 10 o'clock
  secs+=55*60; //add the seconds for the 55 minutes
  datetime barTime=midnight_today+secs;
peterpies
33
peterpies  
Thank you
To add comments, please log in or register