Loading…

Session Open Microscope

The first few minutes after a session opens behave differently from the rest of the day - tick rate jumps, spread often widens then settles, and price can move further than the calm hours either side. Exactly how different is usually left as folklore ("London open is volatile") rather than measured on the trader's own feed and symbol. This script measures it directly. Attach it at or slightly before the configured session open and it samples live bid/ask on the chosen symbol for InpWindowMinutes, tracking the number of ticks, the mean gap between them, the minimum/mean/maximum spread, the bid price excursion (high minus low during the window), and the balance of up-ticks versus down-ticks. Everything is reported once the window closes, with the full tick-by-tick record available in the optional CSV export. A Script runs once and cannot pause for hours, so this deliberately refuses to run rather than block silently if the window has not started yet or has already finished for the day - it says exactly when the window is and asks you to re-attach then, rather than tying up a chart slot waiting. Notes and limitations - The script computes TODAY's session open from the hour/minute inputs. It is meant to be attached once per session, not left running across days. - If attached before the session opens, or after the window has already passed for the day, it refuses to run and states the actual window time rather than waiting or silently doing nothing. - Reported statistics reflect exactly one session's window on one attach - there is no averaging across multiple days built in. Run it on consecutive days and compare the Experts log entries (or the CSV files) by hand for a multi-day picture. - Tick timestamps use the terminal's local clock at millisecond resolution via GetTickCount(), not the broker's server clock, so the spacing between ticks is accurate even though the printed date/time is local.

Script · MT5 · v1.0 · Free

About Session Open Microscope

Session Open Microscope 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, Session start hour and Session start minute. MQL source code included.

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

Settings

SettingDefaultWhat it does
SymbolSymbol to sample, blank = this chart's symbol
Session start hour8Session open hour, server time (0-23)
Session start minute0Session open minute, server time (0-59)
Window minutes15Minutes after the open to capture (max 120)
Poll interval ms20Poll interval while sampling, milliseconds
Save csvtrueWrite every sampled tick to a CSV file
DelimiterDelimiterCommaCSV column separator

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