Loading…

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 · MT5 · v1.0 · Free

About Session Close Positioning Study

Session Close Positioning Study is a script for MetaTrader 5. 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.ex5, SessionClosePositioning.mq5, SessionClosePositioning.txt.

Settings

SettingDefaultWhat it does
SymbolSymbol to study, blank = this chart's symbol
Max bars5000Most recent H1 bars to include
London close hour17London session close, server-time hour (0-23) - the hour ENDING here is studied
New york close hour22New York session close, server-time hour (0-23) - the hour ENDING here is studied

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