Discussion of article "Dealing with Time (Part 1): The Basics"

 

New article Dealing with Time (Part 1): The Basics has been published:

Functions and code snippets that simplify and clarify the handling of time, broker offset, and the changes to summer or winter time. Accurate timing may be a crucial element in trading. At the current hour, is the stock exchange in London or New York already open or not yet open, when does the trading time for Forex trading start and end? For a trader who trades manually and live, this is not a big problem.

As said, traders who sit in front of the screen to buy and sell can easily handle the different times. Be it via the internet or certain functions, values or clocks that the PC keeps available and that can be retrieved at any time with MQL functions like TimeGMT(), TimeGMTOffset() and others. The situation is different if one wants to write and test a trading program with historical data that trades time-related. Actually, analogous to live trading, the question should be just as easy to answer.

Starting from UTC (Universal Coordinated Time) or Greenich Mean Time (GMT, https://greenwichmeantime.com/what-is-gmt/), one would simply have to add the geographic or instrument-related time shift and one would know what time it is where. But it is not that simple. There is the changeover of winter and summer time (DST or Daylight Saving Time), which, depending on the time, adds or subtracts 1 hour. However, not uniform, but each country or region such as Europe has its own definition, sometimes constant for years (EU and USA) or changed every now and then as in Russia, where it was abolished in 2014. In the EU, there was a discussion in 2018, including a survey on the question of abolishing the annual time change (https://ec.europa.eu/germany/news/20180831-konsultation-sommerzeit_de), which resulted in a majority in favor of abolition, so that the Commission submitted a legislative proposal for the end of the time change (https://ec.europa.eu/germany/news/20180914-kommission-gesetzesvorschlag-ende-zeitumstellung_de), which then came to nothing again.

Author: Carl Schreiber

 

Thank you for your article,

I was coding some functions and was stuck on some of the time functions and didnt know how to approach it.

I hope in the future there are more articles on more of the basics of the language and they are extended upon.

Most of my time is spent on creating simple function based the bare bones functionality that is currently present. Its nothing bad I actually enjoy expanding my understanding its really hard to find basic laymen concepts sure the AI and other functionality is great but most of us are normal people working and on the side trading and if the understand was easier to understand more people would want to use the platform the sentiment that i get from forums and other is that well not not talk about it. Thank you for your contributions I hope there is more information like this to come a redo of articles of just the basics is what I really desire and this is high on the list of really good explainations of functions and uses..

 
pi.xero #:

Thank you for your article,

I was coding some functions and was stuck on some of the time functions and didnt know how to approach it.

I hope in the future there are more articles on more of the basics of the language and they are extended upon.

Most of my time is spent on creating simple function based the bare bones functionality that is currently present. Its nothing bad I actually enjoy expanding my understanding its really hard to find basic laymen concepts sure the AI and other functionality is great but most of us are normal people working and on the side trading and if the understand was easier to understand more people would want to use the platform the sentiment that i get from forums and other is that well not not talk about it. Thank you for your contributions I hope there is more information like this to come a redo of articles of just the basics is what I really desire and this is high on the list of really good explainations of functions and uses..

Thank you! I am glad it helps you.
 
Can a broker make the trades appear in MT5 1 hour later than the real London market time e.g. in my case in meta trader 5 I get the time of each trade 1 hour ahead of the London time when the trade I was viewing online e.g. London time 13:10 hrs, time of the same trade in MT5 14:10 hrs.
 
Rolom27 # :
Can a broker make trades appear in MT5 1 hour before the real London market, for example? In my case, in meta trader 5 I get the time of each trade 1 hour before London time, which is where the trade is executed.
Depending on the symbol forex cfd are tradable from Su. 23:00 to Fri. 23:00 depending on time and broker.
 
Carl Schreiber #:
It depends on the symbol forex cfd are tradable from Su. 23:00 to Fri. 23:00 according to time and broker.
Yes with CFD, but why is it 1 hour ahead, I saw it online when the trade was executed and I checked the London time and the time there was 1 hour behind the time MT5 showed me, why?
.
 
Rolom27 # Yes with CFD, but because it comes out 1 hour ahead, I saw it online when the trade was executed and I consulted the London time and the time there was 1 hour behind the one shown by MT5, why?

The time in the terminal is that of the location of the server, that is to say, if the broker is located in London, but the server is in Luxembourg for example, the time zone is different. It has always been and will always be like that.

 
Miguel Angel Vico Alba #:

The time zone in the terminal is that of the server location, i.e. if the broker is located in London, but the server is in, for example, Luxembourg, the time zone is different. It has always been and will always be like that.

Thank you very much, I am checking if the trader is real, today I checked and the prices of the cfds reported in the operations, taking into account the time difference mentioned before, if they coincide with the chart values of the London market that I consult today.
This is the report of meta trader 5 of a trade today that I passed an acquaintance who recently opened an account with that broker, what do you think seems real?
PS I have known of fake brokers that create websites and make it look like they are real brokers and in a few months disappear.
 
Rolom27 #:
Thank you very much, I am verifying if the trader is real, today I checked and the prices of the cfds reported in the operations, taking into account the time difference mentioned before, if they coincide with the values of London market charts that I consult today.
This is the report of meta trader 5 of a trade today that I got from an acquaintance who recently opened an account with this broker, what do you think seems real?
PS I have known of fake brokers that create websites and make it look like they are real brokers and in a few months disappear.

Send me by private message more information about that broker and I can tell you if it is regulated, etc.. Such discussions are forbidden here on the forum.

 

Brilliant article and help! I wasted many months looking at test results that just were invalid.
There should be any hint if the tester is used: "Take care with time dependend strategies in the tester.. " something like that. How could one know?

I think in the first table with the time zones and acronyms you mean "New York, summer time" in row 3 (EDT, UTC-4), not New York, normal time.

 

Thank you very much, but I won't change anything here as the calculation of some of the integrated functions has been changed (I assume in the context of the extended use of matrices and vectors) I posted a new version of all functions and macros and one more here: https://www.mql5.com/en/code/45287.

And there are two programs to test und check the way it works and can be used.

Dealing with time (2) functions
Dealing with time (2) functions
  • www.mql5.com
Calculate DST for USA, EUR, AUD and RUB and the offset time of the broker automatically from the 70's until 2030 - even in the Strategy Tester of MQ.