You can now use:
extern datetime Alert_Time = D'21:45';
Thank you so much for your suggestion :)
It solved a big headache for me.
One small issue I'm facing that it pick a random date if I use D' is it possible to use today's date by default as I usually set alerts for the same day
Well you could risk a look into the editors reference: datetime yyyy.mm.dd hh:mm:ss - so D'2015.10.22 21:45'
It should pick today's date, or maybe the date when the EA was last initialized (not sure which, probably the latter).
If you still have problems, you'll need to calculate it:
datetime Alert_Time = D'21:45'; #define DAY 86400 datetime now = TimeCurrent(), midnight = now - (now % DAY), alert = midnight + (Alert_Time % DAY);
Or use enumerations and have dropdown list(s)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I'm trying to generate alert by EA at a specific time in MT4 . What data type I should use before Alert_time to correctly execute the code.