Discussing the article: "Implementing a Zone-Aware Rollover Window Gate in MQL5"

Check out the new article: Implementing a Zone-Aware Rollover Window Gate in MQL5.

CTradeWindows blocks EA entries during the daily rollover spread spike. Each window is a clock time in a zone such as New York, so it follows that zone through DST. CSpreadProfile learns the windows from tick spreads and saves them to a file that an EA can load. Unit tests and Strategy Tester runs on one server show that a window fixed in server time misses the spike in weeks when the US and EU DST dates differ.

At 17:00 in New York the forex day rolls over, and the spread of many symbols widens for a while. On the test server, in the learning period of this article, the typical spread of EURUSD rose from a baseline of 2.5 points to 54.3 points at 17:02 New York. The learner marks a run of 87 minutes, from 16:33 to 17:59, in which the typical spread is at least three times the baseline. An EA that sends an order in that run pays the wide spread at entry. A stop loss close to the market can also be hit by the spread alone.

A common answer is a time filter in server time with a start hour and an end hour as inputs. The filter blocks entries between the two hours. The filter covers the rollover only while the server clock keeps the same distance to the New York clock. On the server I tested, that distance changes during the year.

I model that server as UTC+2 with the European DST rule, and New York follows the US rule. The two rules change the clocks on different Sundays. In the weeks between those Sundays, 17:00 in New York is 23:00 on the server clock and not 00:00. A filter that blocks the hour after server midnight then covers the wrong hour. The IANA time zone database gives the size of the effect under that model. Consider a window fixed in server time at the position that the New York window has in a normal week. In 2025 and 2026, that fixed window misses 48 of the 626 New York windows from Sunday to Friday.

Author: Ali Akbar