int Cur_Hour=Hour(); // Server time in hours double Cur_Min =Minute(); // Server time in minutes double Cur_time=Cur_Hour + Cur_Min/100;As you are inputting time as a decimal, you need to divide the minutes by 100
Hi,
Thanks for your prompt response, it worked correctly after your suggestion :)
Hi,
Sorry to bother you again, but unfortunately I'm missing something. Lets say I want to generate an alert at 13:00 and server time is 12:25 so I added a server lag of 30 min but its still end of getting alert on wrong time. Im posting a shorter version this time please correct it.
extern double Alert_Time_1 = 13.00; input string MSG1 = "Hi, type you msg here"; bool T1 = false; //--------------------------------------------------------------- 2 -- int start() // Spec. start function { int server_lag = 30; if (TimeCurrent()+ server_lag/100 >=Alert_Time_1 && T1 == false) // If the time for the event has come { Alert(MSG1); T1 = true; }
Why don't you trigger the alert based on your local time? TimeLocal()
Start() will only get called when a new tick comes in. If there is no tick, there is no check of your alert.
Try running your alert from OnTimer() with maybe a 1 second timer
Thanks Knave, I have no issue with TimeLocal() can you tell me what data type should I use before Alert_Time_1 to correctly execute the condition mentioned below
if (TimeLocal() >=Alert_Time_1 ) Alert ();
Also let say I want to execute an alert on Local pc time 19:30, should I write Alert_Time_1 = 19.30 or after converting the fractional part to 19 hr + 30/60 min = 19.5 ?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, I Have written an EA which should generate alert as soon as time exceed the current sever time. My time zone differ from server time by 30 min so I have a condition like
if (Cur_time >(Alert_Time_1 - 0.30)) Alert ()
But Instead of working on Alert time it executes on very next tick. Please show me the right way to use time function in attached EA.