Session Close Positioning Study
"Positioning into the close" is a familiar phrase around session handoffs, but it is rarely backed by anything beyond a chart glance. This script classifies every H1 bar in the requested history into one of three groups - the hour immediately before London's close, the hour immediately before New York's close, or every other hour - and reports, per group, the average bar range in pips, the average signed open-to-close drift in pips, and the average close position inside the bar's own range (0.0 means the bar closed at its low, 1.0 means it closed at its high), plus the percentage of bars that closed in the upper half of their own range. A close position figure well above or below 0.5 for a pre-close group, compared against the "other hours" baseline, is the kind of pattern the phrase "positioning into the close" is actually pointing at - directional bias concentrated specifically in the run-up to a session handoff rather than spread evenly across the day. Close hours are read from two 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. Notes and limitations - Both close-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. - If the two close hours are set one hour apart, or identical, the "pre-close" groups can overlap in unintended ways - the script does not warn about this, so pick distinct, sensibly spaced hours. - Close position is a same-bar high/low/close proxy, not a genuine tick-by-tick order-flow measurement - H1 bar data has no finer resolution.
Script · MT4 · v1.0 · Free
About Session Close Positioning Study
Session Close Positioning Study is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Symbol, Max bars and London close hour. MQL source code included.
Files in the download: SessionClosePositioning.mq4, SessionClosePositioning.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol | Symbol to study, blank = this chart's symbol | |
| Max bars | 5000 | Most recent H1 bars to include |
| London close hour | 17 | London session close, server-time hour (0-23) - the hour ENDING here is studied |
| New york close hour | 22 | New York session close, server-time hour (0-23) - the hour ENDING here is studied |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Trading Sessions · Alerts · MT4 Script · MQL4 Source Code