Give an alert at a specific time or after a daily close
Hi,
I wonder how I can specify an alert at a specific time in the day or an alert after a daily close. Can someone help me with that?
The problem I think is that the functions hour(), minutes() can not be used because it only works when the script/ea loads.
I am going to use it in an EA.
You can use TimeHour() and TimeMinute() with TimeCurrent() to get the current hour and current minute and then alert as appropriate.
if ( TimeHour(TimeCurrent()) == 18 && TimeMinute(TimeCurrent()) == 43 ) { Alert ("It worked!"); }
Can this code work?
Yes, and it will alert for every tick that occurs during 6:43 pm, you probably only want one alert ?
Yes, and it will alert for every tick that occurs during 6:43 pm, you probably only want one alert ?
Very good, I can make a boolean variable so that I do get only one alert. Thanks for help, Raptor UK!
Very good, I can make a boolean variable so that I do get only one alert. Thanks for help, Raptor UK!
One other thing . . . if there is no tick during 6:43 pm you won't get an alert, you might want to check for . . .
if ( TimeHour(TimeCurrent()) == 18 && TimeMinute(TimeCurrent()) >= 43 ) { Alert ("It worked!"); }
. . . and the reset your bool when the hour is > 18
Hi,
I wonder how I can specify an alert at a specific time in the day or an alert after a daily close. Can someone help me with that?
The problem I think is that the functions hour(), minutes() can not be used because it only works when the script/ea loads.
I am going to use it in an EA.