Time Distortion Detector
A bar's tick count compared against its own recent moving average cannot separate "quiet because it's always quiet at this hour" from "quiet because something is actually wrong right now" - both look identical against a blended average that mixes every time of day together. This indicator instead builds each bar's baseline from the SAME clock-minute slot on the previous InpBaselineDays calendar days, matched by exact bar timestamp (today's 14:32 bar against the last several days' own 14:32 bars, not a neighbouring bar or a rounded approximation). That is the actual definition of "distorted for this specific time of day", and it is what a plain volume moving average cannot express. Each closed bar's tick count is expressed as a percentage of that same- time-of-day baseline average and plotted as a line in a separate window, with a marker placed on any bar whose percentage falls below InpCollapseThresholdPct - a feed gap, a broker maintenance window, an unexpectedly thin holiday session, or any other tick-starved bar that would otherwise pass unnoticed sitting next to normal-looking price action. A bar is only ever judged once InpMinBaselineSamples valid same-time-of-day samples exist; early history or an illiquid symbol with many missing days simply shows no reading rather than a false positive built from too few samples. The still-forming current bar is never judged - its tick count is only partway accumulated and would always look artificially collapsed against a baseline built from fully closed bars, right up until it closes itself. Notes and limitations - This measures TICK count, not traded volume - forex/CFD symbols have no centralised traded-volume figure on either MT4 build, so tick count is the standard proxy used throughout this catalogue for activity level. - A day with no exact-timestamp match for a given bar (the symbol was closed, history is missing, or the chart timeframe does not divide the day evenly at that slot) is skipped rather than substituted with a neighbouring bar, so the comparison never silently drifts onto a different time-of-day slot. - The still-forming current bar is never plotted or flagged; the most recent reading is always for the last fully CLOSED bar. - A genuinely quiet period (a market holiday, a symbol with naturally fluctuating liquidity) can legitimately produce a run of flagged bars with nothing actually wrong - this is a screening tool for "worth a second look", not a certainty of a feed problem. - No trade signal or repainting: each bar's reading is fixed once judged and does not change as later bars arrive.
Indicator · MT4 · v1.0 · Free
About Time Distortion Detector
Time Distortion Detector is an indicator for MetaTrader 4. It draws buy and sell arrows on the chart and can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Baseline days, Min baseline samples and Collapse threshold pct. MQL source code included.
Files in the download: TimeDistortionDetector.mq4, TimeDistortionDetector.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Baseline days | 10 | Prior calendar days sampled at the same time-of-day slot |
| Min baseline samples | 5 | Minimum valid baseline samples required before judging a bar |
| Collapse threshold pct | 40.0 | Flag when tick count falls below this % of the baseline average |
| Alert on collapse | false | Popup alert the first time a freshly closed bar is flagged |
| Max bars to process | 2000 | Bars processed backward on first attach, caps startup cost |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Moving Average · Buy/Sell Arrows · Alerts · MT4 Indicator · MQL4 Source Code