Perform task at set time of day

 
HELP!!!! I have almost no hair left from pulling it out - lol

Any of you programers out there - help would be appreciated!!!!

I am trying to perform a routine each day at 00:00 GMT - this code works occasionally but is not picking up every single day (in a 30 day period picks up about 8 days)

if (TimeHour(Time[0])==0 && TimeMinute(Time[0])==0)
{
code goes here......
}
 
HELP!!!! I have almost no hair left from pulling it out - lol

Any of you programers out there - help would be appreciated!!!!

I am trying to perform a routine each day at 00:00 GMT - this code works occasionally but is not picking up every single day (in a 30 day period picks up about 8 days)

if (TimeHour(Time[0])==0 && TimeMinute(Time[0])==0)
{
code goes here......
}

The problem is that Time[0] is time of a tick.
There is no guarantee that you will receive a tick at 00:00 nor that you will receive it within 1min. 2min. ........ interval. It depends on how active the market is at 00:00.
So based on your application, unless you want to use the script, you must use some window.


if (TimeHour(Time[0])==0 && TimeMinute(Time[0]) <=1) // <2 ......etc.
{
code goes here......
}
 
Time[0] is time of current bar beginning and not changed. Time of a tick is CurTime (in most cases)
Reason: