Loading…

High Low Time Of Day Distribution

Traders repeat rules of thumb about when the daily high or low tends to form - "the high is usually made during London", "the low comes on the Asian session" - almost always without having checked. This script checks. For every completed daily bar in the requested history, it scans an intraday timeframe (M15 by default) across that calendar day only, finds the specific intraday bar that carries the day's highest High and the one that carries its lowest Low, and reads that bar's own hour with TimeToStruct. Doing the search on the intraday timeframe rather than the daily bar itself is what makes an hour-level answer possible at all - a D1 bar only knows the day's high and low values, not when within the day they printed. The day boundary handling is the part naive versions get wrong: a daily bar's start and end times are read from the surrounding D1 bars themselves (this day's open time to the next day's open time), and the intraday bar search is clipped to bars that genuinely fall inside that window - a holiday or a missed tick can otherwise make the nearest-bar lookup drift into the wrong calendar day. The result is two 24-row histograms - one for where highs formed, one for lows - each shown as a raw count and a percentage of the days studied, so a session's dominance (or lack of it) is visible directly. Notes and limitations Hours are read directly from the intraday bar's own time - whatever the terminal already shows on the chart (usually broker/server time), with no separate timezone conversion. Compare results across brokers with that in mind. A day with a data gap wide enough that no intraday bar can be matched inside its window is skipped entirely rather than counted with a wrong or empty hour - the day count reported (daysUsed) can be lower than InpDaysToStudy for that reason, especially on a wide intraday timeframe combined with a short history window. This is a distribution over history, not a prediction for tomorrow. A session that dominated the sample can still fail to dominate on any given day; treat the histogram as a base rate, not a signal.

Script · MT5 · v1.0 · Free

About High Low Time Of Day Distribution

High Low Time Of Day Distribution is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 3 settings, such as Intraday timeframe, Days to study and Save csv. MQL source code included.

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

Settings

SettingDefaultWhat it does
Intraday timeframePERIOD_M15Intraday timeframe used to locate the high/low bar
Days to study500Most recent completed trading days to include
Save csvtrueWrite the hourly histogram to a CSV file

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