Loading…

Rollover Time Profiler

Brokers publish a rollover time, but the spread widening a trader actually experiences rarely matches the published figure exactly - it drifts with liquidity conditions, and some brokers simply do not publish one at all. This tool does not trust the advertised time. It samples the chart symbol's spread on a timer, maintains a rolling median baseline of normal spread, and confirms a widening episode only once the spread has held above a multiple of that baseline for a configurable number of seconds - the same debounce is required before declaring the episode over. The debounce matters more than it looks. A single noisy tick either side of the real event, sampled without confirmation, would be logged as a widening episode of its own and the learned window would end up far wider than what actually happens. Requiring the new state to hold before it counts is what turns raw spread noise into a genuine profile of the broker's behaviour. Every confirmed episode is appended to a CSV, and the running profile - earliest, median and latest observed widen-start time of day - is rebuilt from that log at start-up, so the picture only gets more reliable the longer the EA has been left running, restarts included. Notes and limitations - This tool detects the spread-widening window only. It cannot observe the moment swap is actually posted without an open position on the account, since MQL4 exposes swap only through OrderSwap() on a real or historical order; correlate the logged window against the Trade tab's swap entries by hand if that confirmation matters. - The baseline only accepts samples taken while solidly in the normal state, so a broker with a permanently elevated or highly variable spread will need a correspondingly higher InpWideningMultiplier to avoid false positives. - One instance covers one symbol. Attach a separate chart and instance per symbol that needs its own profile. - Read-only. It never sends, modifies or closes an order - only MarketInfo and file writes are used.

Expert advisor · MT5 · v1.0 · Free

About Rollover Time Profiler

Rollover Time Profiler is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Widening multiplier, Confirm seconds and Baseline sample count. MQL source code included.

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

Settings

SettingDefaultWhat it does
Widening multiplier2.5Spread must reach this multiple of the learned baseline to count as widening
Confirm seconds20Seconds the new state must hold before a transition is confirmed
Baseline sample count60Recent normal-spread samples kept for the rolling baseline
Check interval secs5Seconds between spread samples
Log fileRolloverTimeProfiler.csvFile in MQL5\Files that each confirmed episode is appended to

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: Alerts · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria