Inter Tick Time Snapshot
An average tick interval hides the shape of a feed. A symbol producing one tick every second on average could be doing that steadily, or it could be sitting idle for four seconds and then firing five ticks in the same instant during a burst - two very different feeds for anything that reacts to tick timing, and an average alone cannot tell them apart. MQL4 gives a Script no tick event at all - only Experts get OnTick(). This works the way the rest of this catalogue's tick-density tools do: poll MarketInfo(symbol, MODE_TIME) on a short timer and treat a changed value as one new tick, timing the gap with GetTickCount() at the moment the poll notices the change. This is not the broker's own microsecond tick timestamp - MQL4 does not expose one to a Script - so every reported gap carries up to one poll interval of measurement slack, and two ticks landing inside the same poll interval get merged into one. A short InpPollIntervalMs narrows that slack at the cost of more CPU spent polling. The result is reported as a full distribution: minimum and maximum gap, mean, median, and a histogram bucketed from sub-100ms up to half a minute and beyond. The median in particular is often far more informative than the mean on a bursty feed, since a handful of multi-second idle gaps can drag the mean upward while the typical gap between ticks in an active burst stays small. Notes and limitations - This measures ARRIVAL as seen by a polling loop, not the broker's own tick timestamp - see the full description for why MQL4 has nothing finer to offer a Script. Treat the numbers as accurate to within roughly one poll interval, not to the millisecond. - Two or more ticks landing inside the same poll interval are counted as one - the reported tick count is a lower bound on how many ticks the broker actually sent during a genuinely fast burst. - The very first detected tick is used only to start the clock and is dropped from the reported statistics, since it has no real predecessor to measure a gap against. - Sampling blocks the script for the full InpSampleSeconds (or until IsStopped() is triggered by removing the script) - this is expected; a Script has no way to run in the background between polls. - Results are specific to the exact time window sampled. A symbol's tick rate varies enormously between session opens, news releases and quiet hours - run at a time representative of what you actually want to know about.
Script · MT5 · v1.0 · Free
About Inter Tick Time Snapshot
Inter Tick Time Snapshot 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 Symbol, Sample seconds and Poll interval ms. MQL source code included.
Files in the download: InterTickTimeSnapshot.ex5, InterTickTimeSnapshot.mq5, InterTickTimeSnapshot.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol | Symbol to sample (blank = this chart's symbol) | |
| Sample seconds | 120 | How long to sample |
| Poll interval ms | 15 | Poll frequency - lower catches more ticks but costs more CPU |
| Max ticks | 5000 | Sampling stops early if this many ticks are captured first |
| Save csv | false | Also write every individual gap 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