Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Check server time changes due to daylight saving time (DST) transition - MetaTrader 5 script

author EAcpu | 4 reads | 0 comments |


Unfortunately, I found that some brokers were a little sloppy with server time changes due to Daylight Savings Time (DST), which I wasn't expecting and which surprised me.

The Forex trading session is exactly 120 hours:
Eastern Standard Time (North America) or EST starting Sunday at 5:00 p.m.
to 5:00 p.m. ET on Friday.

The problem arises due to the time change between DST and DST, which does not change.
Held on the same Sunday in different parts of the world.

For example, the second Sunday in March and the first Sunday in November in the United States will change.
This also affects the start and end of a Forex trade.

The EU changes on the last Sunday in March (after the US) and on the last Sunday in October before the US (see schedule above).

This creates a transition period in which the US and EU have different time differences that are 5 hours (London), 6 hours (Frankfurt, Central European Time) or 7 hours (Cyprus, Eastern European Time) later than normal.

During this transition period, changes in time differentials should be reflected in the timestamps of the first and last hours of the changing FX trading session. Therefore, if the Forex trading session starts on Monday at 00:00 (EET, MQ time), after the US changes, it should start one hour earlier,
That is 23:00 on Sunday, and ends one hour earlier on Friday, that is, 23:00 (or 22:59:59).

But unfortunately I have to find out (with this script anyone can check with their agent)
On MQ demo account and some real broker's accounts, the first hour always (!) appears Monday 00:00, but the last hour, as expected,
Friday at 23:00 (or 22:59) or one hour earlier. This means that the first hour of the Forex trading session is missing, and traders or EAs can react to weekend events during the Forex trading session.
Furthermore, the end of the Forex trading session can no longer be determined by simply adding 120 to the first hour of the Forex trading session, for example to close all positions before the weekend.

The script now checks the broker for past time changes and logs all forex sessions which is obviously incorrect (odd) or not 120 hours. If there are 120 hours between the first and last hour of Forex trading, nothing will be recorded.

Finally, the script prints the last retrieved timestamp, the odd number of sessions found, and the approximate number of years that have been checked.

Leider musste ich feststellen, dass manche Broker bei der
Serverzeitumstellung etwas nachlässig sind, was ich nicht erwartet
hatte und was mich sehr überrascht hat.

Die FOREX-Sitzung dauert genau 120 Stunden:
von Sonntag 17:00 Uhr Eastern Standard Time (Nordamerika) bzw. Eastern Time 2Freitag 17:00 Eastern Time

Das Problem entsteht durch die Zeitumstellungen auf Sommerzeit und Winterzeit,
Die in the densest areas in the world.

Die USA stellen beispielsweise am 2. Sonntag im März und am 1. Sonntag im October Well,
It’s the beginning and end of the Forex trading rush.

EU will be held on March night, also in the US
letzten Sonntag im Oktober, also from the United States, hmm (siehe obige timeline).

In the United States and the European Union, Dadurch entsteht eine Übergangszeit
Time difference and normal difference 5
Stunden (London), 6 Stunden (Frankfurt, MEZ) or 7 Stunden (Zypern, EET).

In dieser Zwischenzeit sollte sich diese änderung der Zeitdifferenz in den
Please be aware of the timing and scope of Forex trading.
Wenn die FOREX-Sitzung also in Montag um 00:00 (EET, MQ-Zeit) beginnt, sollte sie
nach der änderung in den USA eine Stunde früher beginnen, also Sunday 23:00 Uhr,
und am Freitag eine Stunde früher enden, also um 23:00 Uhr (or 22:59:59 Uhr).

Aber leider musste ich feststellen (und mit diesem Script kann das jeder bei seinem
Broker überprüfen), dass auf einem MQ Demokonto and auf Konten einiger echter Broker
die erste Stunde immer(!) am Montag um 00:00 erscheint, die letzte Stunde aber erwartungsgemäß
am Freitag um 23:00 (bzw. 22:59) oder eine Stunde früher. Damit Fehlt die erste Stunde
During the Forex trading session, in the EA's handler, we will introduce information about the EA.
Auch kann das Ende der FOREX Session nicht mehr badurch bestimmt werden, indem einfach120 zur
Forex trading session ersten Stunde hinzuaddiert wird, um zB Alle Positionen vor dem Wochenende zu schließen.

Broker's script during the trading process
FOREX Sessions mit, die offensichtlich falsch (odd) oder nicht 120 Stunden sind. Before and after Wenzwischen, FOREX-Session 120 Stunden liegen, erfolgt kein Ausdruck im Log.

Am End Druckt das Skript den Zuletzt abgerufenen Zeitstempel, die Anzahl der Gefundenen
Please be aware of the current year's circumstances and circumstances.


Attachment download

📎 test_weekenddata.mq5 (26.73 KB)

Source: MQL5 #55056

Verification code Refresh