Loading…

Session Range Ratio Tracker

"Asia is quiet, London and New York do the real moving" is common trading folklore, but it is rarely backed by anything beyond a chart glance. This script walks every calendar day in the requested H1 history, tracks the high and low seen inside each of the three session windows separately from the day's own overall high and low, and reports two figures per session: the average ratio of that session's own range to the day's full range, and the percentage of days on which that session posted the largest single-session range of the three. Session windows are read from six plain hour inputs rather than a fixed table, because every broker's server clock sits at a different offset from GMT, and that offset itself changes with each side's own daylight-saving calendar. The hour windows handle wraparound past midnight, since some broker clocks place a session's hours on either side of the day boundary. Days are grouped by a simple time-division day key rather than a broker-specific session-open convention, which keeps the grouping logic honest about what it actually measures: a UTC-aligned server-time calendar day, not a trading-day convention. A day contributes to a session's statistics only if at least one H1 bar actually fell inside that session's window during the scan - a day with a data gap in one session is excluded from that session's average rather than silently counted as a zero. Notes and limitations - All six session-hour inputs are server time as reported by iTime(); they are not auto-detected and must be set to match the broker this history came from. - Calendar days are grouped by a plain 86400-second time division of the server clock, not by the broker's own "trading day" rollover convention - on brokers whose day rolls over at a non-midnight server hour this can occasionally split a session's hours across two reported days. - Overlapping session windows (as London and New York normally are) will let the overlap hours count toward both sessions' ranges - this is intentional for a ratio tracker, not a bug, since the point is each session's own footprint, not a mutually-exclusive partition.

Script · MT4 · v1.0 · Free

About Session Range Ratio Tracker

Session Range Ratio Tracker is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 8 settings, such as Symbol, Max days and Asia start hour. MQL source code included.

Files in the download: SessionRangeRatio.mq4, SessionRangeRatio.txt.

Settings

SettingDefaultWhat it does
SymbolSymbol to study, blank = this chart's symbol
Max days500Most recent calendar days to include
Asia start hour0Asia session start, server-time hour (0-23)
Asia end hour8Asia session end, server-time hour (0-23, exclusive)
London start hour8London session start, server-time hour (0-23)
London end hour16London session end, server-time hour (0-23, exclusive)
New york start hour13New York session start, server-time hour (0-23)
New york end hour22New York session end, server-time hour (0-23, exclusive)

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Trading Sessions · Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria