Loading…

Hour Weekday Heatmap Export

"Which hour is best" and "which hour is calm" are two different questions that a single average-return-by-hour table quietly conflates: a quiet grinding hour and a wild whipsaw hour can average out to the same mean return while behaving nothing alike to trade. This script walks historical bars on the chosen symbol and timeframe, buckets each bar by its weekday and hour (server time), and reports two grids instead of one - mean close-minus-open return, and mean high-minus-low range, both converted to pips - so the two questions stay visible side by side rather than being collapsed into one number. Both grids are written into the same CSV, one after another with a blank row between, columns ordered Monday through Sunday for a trader-friendly sheet even though the underlying MQL4 weekday numbering starts at Sunday. Pasting either grid into a spreadsheet and applying a colour scale across the 24x7 block turns it into a heatmap with no further transformation needed. Notes and limitations Hour and weekday are read from the bar's OPEN time in the broker's SERVER time - not GMT, and not the timezone of whoever is reading the export. Cells with zero bars observed are left blank in the CSV rather than shown as a misleading 0.00. Only whole bars fully inside the lookback window are counted - a bar whose open time falls before the cutoff simply stops the walk, it is not partially counted. Mean range (high-low) is not the same as volatility in the statistical sense; it is a simple average of each bar's own high-low spread, which can be dominated by a handful of unusually wide bars in a small sample. Widen InpLookbackDays for a steadier picture on lower timeframes.

Script · MT4 · v1.0 · Free

About Hour Weekday Heatmap Export

Hour Weekday Heatmap Export is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 3 settings, such as Symbol, Timeframe and Lookback days. MQL source code included.

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

Settings

SettingDefaultWhat it does
SymbolSymbol (blank = current chart symbol)
TimeframePERIOD_H1Bar timeframe to sample
Lookback days60How many days of history to walk

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: Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria