Loading…

Session Overlap Behaviour Study

"Trade the overlap, it's the most active time" is common advice, but it is rarely backed by anything beyond a chart glance. This script sorts every H1 bar in the requested history into one of three classes - inside both London and New York hours, inside exactly one of them, or inside neither - and reports, per class, the average bar range in pips, the average absolute open-to-close drift, and the rate of bars that moved a meaningful distance in both directions before closing (a simple two-sided/"reversal" flag). Session hours are read from four 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 also handle wraparound past midnight, since some broker clocks place a session's hours on either side of the day boundary. The reversal flag is intentionally simple: a bar counts as two-sided when both its open-to-high move and its open-to-low move exceed a configurable fraction of the bar's own range. It is a rough proxy for "the bar didn't just walk in one direction", not a claim about intrabar tick sequencing, which H1 bar data cannot reconstruct. Notes and limitations - All four 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. - The reversal flag is a same-bar open/high/low proxy, not a genuine tick-by-tick reversal count - H1 bar data has no finer resolution. - Session windows that overlap by design (as London/New York normally do) will always populate the "Overlap" class; setting both windows identical or non-overlapping is a valid but different study.

Script · MT5 · v1.0 · Free

About Session Overlap Behaviour Study

Session Overlap Behaviour Study is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 7 settings, such as Symbol, Max bars and London start hour. MQL source code included.

Files in the download: SessionOverlapStudy.ex5, SessionOverlapStudy.mq5, SessionOverlapStudy.txt.

Settings

SettingDefaultWhat it does
SymbolSymbol to study, blank = this chart's symbol
Max bars5000Most recent H1 bars to include
London start hour8London session start, server-time hour (0-23)
London end hour17London 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)
Reversal fraction0.30Both open->high and open->low must exceed this fraction of the bar's range to count as a two-sided (

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 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 · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria