Hello
How can I get and display the hour and minute from market watch in mql5 ? Display hours and minutes individually and together
thank you
Use function: datetime TimeCurrent( MqlDateTime& dt_struct) and then dt_struct.hour and dt_struct.min
I tried I do not know how to use this function
Can you say something in detail?
I tried I do not know how to use this function
Can you say something in detail?
void OnStart() { MqlDateTime dt_struct; datetime dtSer=TimeCurrent(dt_struct); printf("Server time: %d:%d:%d ; Just hours: %d ; Just minutes: %d",dt_struct.hour,dt_struct.min,dt_struct.sec,dt_struct.hour,dt_struct.min); }This script print info about server time in terminal window (tab Strategy)
This script print info about server time in terminal window (tab Strategy)
how to use this code in Comment() in expert ?
MqlDateTime dt_struct;
datetime dtSer=TimeCurrent(dt_struct);
void OnTick()
{
int mins = dt_struct.min ;
Comment(mins) ;
}
Because this code is not true
Forum on trading, automated trading systems and testing trading strategies
Script/EA to open buy/sell position few pips away from current
Alain Verleyen, 2016.03.30 10:46
Welcome,
- Usually people who can't code don't receive free help on this forum, though it could happen if you are lucky, be patient.
- If you show your attempts and describe well your problem, you will most probably receive an answer from the community.
- If you don't want to learn to code, nothing bad, you can either look at the Codebase if something free already exists, or in the Market for paid products (sometimes free also).
- Finally, you also have the option to hire a programmer in the Freelance section.
Good luck.
i have no experience in time functions in mql5
I want to display the minutes and hours of market in my Expret by Comment()
For example, I use this code to display seconds
int Seconds( void )
{
return((int)TimeCurrent() % 60) ;
}
void OnTick()
{
int sec = Seconds() ;
Comment(sec) ;
}
but I do not know how to display the minute and the hours
Forum on trading, automated trading systems and testing trading strategies
Alain Verleyen, 2016.12.01 22:07
Hello,
Please EDIT your post and use the SRC button when you post code.
i have no experience in time functions in mql5
I want to display the minutes and hours of market in my Expret by Comment()
For example, I use this code to display seconds
int Seconds( void ) { return((int)TimeCurrent() % 60) ; } void OnTick() { int sec = Seconds() ; Comment(sec) ; }
but I do not know how to display the minute and the hours
i have no experience in time functions in mql5
I want to display the minutes and hours of market in my Expret by Comment()
For example, I use this code to display seconds
but I do not know how to display the minute and the hours
I asked you to edit your first post, not to create a new one, but ok not a problem you know it for an other time.
Anyway, Petr already answered you how to get minutes and hours, you just have to use this code and add minutes and hours to your Comment() statement.
I asked you to edit your first post, not to create a new one, but ok not a problem you know it for an other time.
Anyway, Petr already answered you how to get minutes and hours, you just have to use this code and add minutes and hours to your Comment() statement.
but this code is not true
MqlDateTime dt_struct; datetime dtSer=TimeCurrent(dt_struct); void OnTick() { int min = dt_struct.min ; Comment(min) ; }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
How can I get and display the hour and minute from market watch in mql5 ? Display hours and minutes individually and together
thank you