Loading…

Price Ladder Granularity Profiler

A 5-digit broker quote looks like it offers pipette-level resolution, but plenty of pricing engines only ever populate every second or every fifth value of that last digit - a half-pip or coarser ladder dressed up as full resolution. Nothing about the chart or the Market Watch window tells a trader this; it only becomes visible once enough ticks are sampled and the final digit is looked at as a distribution rather than a single number. This script does that sampling live, tick by tick, rather than reading bar history. Bar Close only ever stores the last tick of that bar, so a ladder artefact confined to intra-bar ticks would be completely invisible to a history-based approach - exactly the case this profiler exists to catch. It converts each new Bid into whole MODE_POINT units, builds a histogram of the final digit across up to InpSampleTicks distinct price levels, and also tracks the greatest common divisor of the steps between consecutive distinct levels - a ladder that only ever steps by 5 units is a genuine half-pip ladder; one that steps by 1 uses the full available resolution. The result is reported as a plain digit histogram plus a one-line interpretation, and optionally exported to CSV for anyone who wants to look at the raw counts themselves. Notes and limitations - Samples live ticks for as long as the script runs; it cannot retroactively profile a period before it was attached, and a quiet market may end the run early with InpMaxWaitSeconds rather than a full sample. - The greatest-common-divisor step calculation is only meaningful once several price changes have occurred - a run that ends with very few changes reports a less conclusive interpretation, which the script says plainly rather than overstating confidence. - Profiles Bid only. Ask can have its own independent granularity on some feeds, particularly where spread is added as a fixed number of points - this script does not separately profile Ask. - A broker that changes its pricing engine's granularity between sessions (common around low-liquidity hours) will show a different result at different times of day; this is expected, not a bug.

Script · MT4 · v1.0 · Free

About Price Ladder Granularity Profiler

Price Ladder Granularity Profiler is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 3 settings, such as Sample ticks, Max wait seconds and Export csv. MQL source code included.

Files in the download: PriceLadderGranularity.mq4, PriceLadderGranularity.txt.

Settings

SettingDefaultWhat it does
Sample ticks300Stop once this many distinct ticks have been sampled
Max wait seconds120Give up waiting for enough ticks after this many seconds
Export csvtrueWrite the digit histogram and raw samples to CSV

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 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 · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria