Symbol Session Times Extractor
A strategy that is only meant to trade during the London session, or that should stay flat while the underlying exchange is shut, needs to know that venue's actual hours - and those hours are not the same across brokers, symbols or weekdays. A CFD on an index typically only quotes during its exchange's cash session; an FX pair can carry a short lunch-hour quiet spell in the platform's own session tables even though quotes never fully stop. Guessing at these from a chart, by eye, misses the exact boundary and misses any second session in the same day entirely. The platform already publishes this - SymbolInfoSessionQuote and SymbolInfoSessionTrade report it session by session for any symbol and any day of the week - but nothing in the terminal shows it as one readable table. This script walks every session slot the platform reports, for every symbol in Market Watch (or a supplied list) and every day Sunday through Saturday, and writes one CSV row per session. A day with no sessions at all gets its own explicit row, so "the market is shut Saturdays" shows up as data rather than as a silent absence you would only notice by scrolling gaps in a chart. Quote sessions and trade sessions are recorded separately and can differ - a symbol can be quotable without being tradeable for part of a session, and the trade_session_present column marks exactly where that happens. Notes and limitations - Reports whatever the broker's own server publishes through the platform's session functions. A broker that does not populate detailed session data will show a single all-day session, or none, exactly as the server sends it - this script cannot see more than the server exposes. - day_of_week and the session times are all server time, the same clock the Strategy Tester itself uses - not your local time and not GMT. - The times reported are time-of-day only. There is no calendar date attached, so a session that is currently suspended for a public holiday will still show its normal weekly hours; this script does not read a holiday calendar. - A symbol that fails SymbolSelect() is still attempted, since some brokers answer session queries for symbols outside Market Watch; the log notes when this happens.
Script · MT5 · v1.0 · Free
About Symbol Session Times Extractor
Symbol Session Times Extractor is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Symbol list filename, Max sessions per day and Include closed days. MQL source code included.
Files in the download: SymbolSessionTimesExtractor.ex5, SymbolSessionTimesExtractor.mq5, SymbolSessionTimesExtractor.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol list filename | Optional symbol list file, in MQL5\Files (blank = every Market Watch symbol) | |
| Max sessions per day | 5 | Safety cap on session slots checked per symbol per day |
| Include closed days | true | Write a row for a day with zero quote sessions |
| Delimiter | DelimiterComma | CSV column separator |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Trading Sessions · Time Filter · Alerts · MT5 Script · MQL5 Source Code