Loading…

Historical Max Spread Scanner

The spread you see is not the spread you pay. Stops get clipped at rollover, at news, in the minutes before the weekend - exactly the moments nobody is watching the quote panel. What matters for placing stops and judging a broker is the spread's history: how wide it goes, how often, and at which hours. The MQL5 version answers that from real data. It iterates the symbol's actual tick history with CopyTicksRange over the last N days (default 7), fetched in one-day slices so a multi-million-tick window never has to sit in memory at once, with progress printed per chunk. Every tick's spread lands in an integer histogram per hour of day, which makes the median and the 95th percentile exact - no sampling, no estimation. The report is a 24-row table in server time: tick count, median, p95, maximum in points and pips per hour, with the widest hour marked. The rollover hour is usually unmistakable. The report also states the window the broker ACTUALLY delivered ticks for, which is frequently shorter than the window you asked for - a silent truncation most tick tools do not admit to. The MQL4 version is honest about a hard platform limit: MQL4 has no tick history API at all. Nothing can recover last week's spreads from an MT4 terminal, and bar data never contained them. So on MQL4 the script states that limitation prominently and then does the one real thing it can do: sample the live spread once per second for an input duration (default 60 seconds) and report min, median, p95 and max of that sample, labelled loudly as a live sample of the present moment, not history. The output even tells you to treat its numbers as the quiet-market case. Both versions only read. No orders, no chart objects, no side effects. Notes and limitations - Hours are SERVER time. Combine with a GMT offset report if you need the table in your local clock. - MQL5 tick depth is set by the broker. Requesting 90 days may deliver 10; the "actual tick coverage" line states what was really scanned. - COPY_TICKS_INFO returns quote-change ticks. Trade-only ticks carry no fresh quote and are not part of a spread profile. - Ticks with an empty or crossed quote are counted and excluded, never repaired into data. - The MQL5 histogram caps at 5000 points; spreads beyond the cap keep their exact maximum but percentiles report ">5000" rather than a made-up figure. - The MQL4 sample is one contiguous window. Sixty seconds at 14:00 says nothing about 23:55 Friday; the output says as much. - Weekend runs on MQL4 will mostly collect dead quotes and report honestly that there was nothing to measure.

Script · MT5 · v1.0 · Free

About Historical Max Spread Scanner

Historical Max Spread Scanner is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 2 settings, such as Days and Save csv. MQL source code included.

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

Settings

SettingDefaultWhat it does
Days7Days of tick history to scan
Save csvfalseAlso write the report to a CSV file

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: Dashboards & Scanners · News Trading · Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria