Loading…

Round Level Tick Clustering Sampler

"Price clusters around round numbers" is one of the most repeated claims in retail trading commentary, and one of the least often actually measured. This script measures it directly on live ticks rather than assuming it. It samples the chosen symbol's bid for InpDurationSeconds and, for every changed tick, works out the distance from that tick to the nearest round level, where a round level is any multiple of InpRoundStepPoints. That distance always falls in [0, half a step] - a tick can never be closer to the far edge of a step than to the level it just crossed - so the script compares the observed share of ticks landing within InpNearThresholdPoints of a level against the share a UNIFORM distribution over that half-step would predict. A clustering factor above 1.0 means ticks land near round levels more often than chance would produce; a factor near 1.0 means they do not, on this feed, at this step size, over this sample. A ten-bin distance histogram is also printed and exported, so the shape of the distribution - not just the single summary ratio - can be inspected directly. Notes and limitations - This measures where TICKS land relative to round levels, not where price REACTS (reverses, stalls) near them - it is a distributional study, not a support/resistance study. - The uniform baseline is a modelling choice, not a law of markets. It is the natural "no clustering at all" null to compare against; a clustering factor of 1.0 does not prove randomness, only that this particular test found no departure from it. - Results depend on InpRoundStepPoints. A step chosen far from how the symbol is actually quoted (for example, a five-digit step on a three-digit JPY pair) will not find whatever clustering genuinely exists at the levels traders actually watch. - The script samples ticks live for a bounded window; it does not scan historical ticks, since MT4 keeps no tick history to scan.

Script · MT5 · v1.0 · Free

About Round Level Tick Clustering Sampler

Round Level Tick Clustering Sampler 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, Duration seconds and Poll interval ms. MQL source code included.

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

Settings

SettingDefaultWhat it does
SymbolSymbol to sample, blank = this chart's symbol
Duration seconds300How long to sample, seconds (max 1800)
Poll interval ms10Poll interval while sampling, milliseconds
Round step points100Spacing between round levels, points
Near threshold points5A tick within this many points of a level counts as "near round"
Save csvtrueWrite the distance histogram to a CSV file
DelimiterDelimiterCommaCSV column separator

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 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria