iForexSessions - MetaTrader 5 Script | Trading Script Download - MT4/MT5 Resources





This indicator assumes the local "wall clock" trading hours of each FX market are 8:00 AM - 5:00 PM, except Sydney, where trading hours are 7:00 AM - 4:00 PM or 9:00 AM - 6:00 PM.
Draw colored rectangles for Forex market periods (Sydney, Tokyo, London, New York).
Exact trading times on Forex pairs and gold charts (Forex pairs trading starts at 17:00 New York. Gold starts one hour later).
This indicator takes into account the GMT offset + daylight saving time of the broker's server and time zone.
The time calculation of the indicator uses time zone information base
Clocks of other brokers (located in the lower left corner) and some useful information:
- Broker GMT offset
- The remaining time before the weekend (so you can close open trades or skip new trades before the weekend).
- Local computer time synchronization status. Check the prompt https://time.is/ if the computer time is out of sync.
Move the mouse pointer over the chart bar while holding down the "Ctrl" key: the bar number and time (and the corresponding time for the main Forex market) will be written to the chart window for debugging.

By default, the indicator will search and load the XAUUSD symbol to estimate the server's time zone offset. XAUUSD can provide more reliable results (especially for brokers who follow the rules) EU Daylight Saving Time weeks during which US DST and EU DST schedules are out of sync (March and late October). Alternatively, if your broker follows the US DST schedule, or has no schedule at all, then using chart symbols will work too. Set this parameter to "false" to use the current chart's symbol instead of XAUUSD.
To determine a broker's Daylight Saving Time (DST) schedule, you can use this script https://www.mql5.com/en/code/48650
As a side effect of XAUUSD starting one hour after Forex trading, the daylight saving time switch will happen an hour later (only in the strategy tester, not in normal mode).
Bonus feature: Hold down the "Ctrl" key while moving the mouse pointer on the chart bar
The bar number # and its time (and corresponding times for major FX markets) will be written to the chart window for debugging purposes.
Then, to remove the debugging information from the chart, just click the mouse anywhere on the chart (without pressing the "Ctrl" key).
Trading session opening - closing
Forex market session identification
All of the above indicators (and almost all others in the code base) use hardcoded fixed time zone offsets and do not take into account daylight saving time on the broker's server or time zone. In short, this is inaccurate, as session times do change throughout the year, either because 1) a broker switches their time zone to DST, or 2) one or more of the major FX markets changes their time zone to DST.
Note : This indicator is confirmed to work with the following list of brokers (with different trading schedules, GMT offsets and summer DST schedules):
The indicator should work fine on other brokers as well.
During testing in the strategy tester, timeGMT() always equal to time trading server() Simulate server time.
The TimeZoneInfo library estimates the correct time for a time zone based on "real" GMT by analyzing H1 quote history, rather than based on the time returned by calling the built-in TimeGMT function.
If the input parameter "Load XAUUSD symbols to estimate server's TZ/DST" is set to TRUE: then dst switching may occur in the strategy tester after an hour.
Attachment download
📎 TimeZoneInfo.mqh (121.12 KB)
📎 SessionHours.mqh (17.48 KB)
📎 iForexSessions.mq5 (39.42 KB)
Source: MQL5 #48842
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •