Rollover Window Behaviour Study
Swap rollover has a reputation for erratic price behaviour, but the claim is rarely checked against the symbol's own history. This script walks back through M1 bar data, night after night, measuring the high-low range and the net open-to-close drift inside a configurable window centred on the broker's rollover instant, and compares the mean of both figures against a baseline built from windows of the identical length spread through the other twenty-three hours of the same calendar days. The comparison is deliberately restricted to what M1 bar history can actually prove: range and net price movement. MT4 does not store historical spread inside bar data at all, so a "spread widens at rollover" claim cannot be tested from history the way range and drift can. Rather than fabricate a historical spread figure, this script reports only the CURRENT live spread at the moment it runs, clearly labelled as a single live reading, and explains directly why a genuine historical spread study is not possible from bar data alone. Notes and limitations - Spread is reported as a single LIVE snapshot only, not a historical statistic - MT4 keeps no spread history inside bar data, so this cannot be reconstructed from history the way range and drift can. To check spread behaviour at rollover on this broker, watch MarketInfo(symbol, MODE_SPREAD) live across an actual rollover. - Requires enough loaded M1 history to cover InpLookbackDays; the script reports plainly when it does not have enough and skips days it cannot find bars for rather than fabricating a figure. - Rollover time is broker-specific and can itself shift with daylight saving on brokers that observe it - confirm the correct hour/minute before drawing conclusions from a long lookback.
Script · MT5 · v1.0 · Free
About Rollover Window Behaviour Study
Rollover Window Behaviour Study 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, Rollover hour and Rollover minute. MQL source code included.
Files in the download: RolloverWindowStudy.ex5, RolloverWindowStudy.mq5, RolloverWindowStudy.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol | Symbol to study, blank = this chart's symbol | |
| Rollover hour | 23 | Broker-time hour the rollover window is centred on |
| Rollover minute | 59 | Broker-time minute the rollover window is centred on |
| Window minutes | 10 | Minutes on EACH SIDE of the rollover instant to include |
| Lookback days | 180 | Trading days to scan back through M1 history |
| Baseline samples | 20 | Random-ish baseline windows per day, spread across the other 23 hours |
| Save csv | true | Write the per-day rollover window figures to a CSV file |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT5 Script · MQL5 Source Code