Discussion of article "MQL5 Programming Basics: Time"

 

New article MQL5 Programming Basics: Time is published:

The article focuses on standard MQL5 functions for working with time, as well as programming techniques and practically useful functions for working with time that are required when creating Expert Advisors and indicators. Particular attention is paid to the general theory of time measurement. This article should be of interest primarily to novice MQL5 programmers.

MQL5 Programming Basics: Time

Author: Dmitry Fedoseev

 
"01.12.2012 - first of January 2012." - maybe December?
 
Or maybe 01.01.2012 :)
 
Waiting... they'll fix it.
 
Integer:
Or maybe 01.01.2012 :)
Corrected, thanks.
 

You should not have used the term"winter" time.

It should be called standard time, because according to the rules (and even in Windows as well) it is called standard time.

Winter is a common name. It is not summer.

When you call it Summer or Standard, it is immediately clear that it is summer time that is not standard, which has an extra hour.

 
What does the phrase "All chart elements are set to invisible colour" mean and where is it in the script code? Thank you.
 
It's not in the code, it's on the image, for clarity, so that the script could be better seen. It's manually disabled.
 
Hello, honoured programmer. For me, programmers are like gods - to create something working out of nothing out of air and even creating material things is just fantastic...You determine only the moment from the beginning, but how to set the periodicity. So far I have to rename EAs so that each starts and stops at its own time, but since in MT5 there is only one pair - one EA, I have to switch manually. Thanks
 

Great article. It's nice when everything is collected and after reading it all builds up in your head into a system.

I would like more information on the transition (or not) of different exchanges to summer time.

And also I am interested in the question of how to programme testing taking into account Forex time zones, if some exchanges switch to summer time and others do not?

At the same time, the dates of transition are different everywhere, and the rules for selecting these dates may have changed over the years.

Has anyone coded something like this?

 

I will add my penny. Function for getting the time parameter (using it in the code is more compact).

//=====================================================================================================================
// Returns the required time parameter
// int TimeGet(datetime).year; // year
// int TimeGet(datetime).mon; // month
// int TimeGet(datetime).day; // day
// int TimeGet(datetime).hour; // hour
// int TimeGet(datetime).min; // minutes
// int TimeGet(datetime).sec; // seconds
// int TimeGet(datetime).day_of_week; // day of the week (0-Sunday, 1-Monday, ...,6-Saturday).
// int TimeGet(datetime).day_of_year; // ordinal number in the year (1 January has the number 0)
//=====================================================================================================================
MqlDateTime TimeGet(datetime par_time) {
   MqlDateTime stm;
   TimeToStruct(par_time, stm);
   return(stm);
}

It seems to work, but when you enter a point the drop-down list of elements of MqlDateTime structure does not appear :(