Loading…

Stale Quote Detector

An EA reading Bid/Ask has no way to tell a genuinely quiet market from a feed that has simply stopped updating - both look identical from inside OnTick, because a frozen feed still returns the last price it received. This tool watches from the outside, on its own timer, so it keeps checking every listed symbol regardless of whether ticks are arriving for the chart it is attached to. Two separate conditions are alerted. A frozen feed is a fixed absolute threshold: no new quote for longer than InpFrozenThresholdSecs, which catches a symbol that has stopped completely. A slow feed is relative: once each symbol has built up a baseline of its own normal gap between quotes, a current gap several times that average triggers a second kind of alert - which is what actually differs by symbol and by session, since a five-second gap is unremarkable on an illiquid cross overnight but would be a serious warning sign on EURUSD during London hours. Each symbol learns its own baseline independently and keeps learning while it is not stale, so the threshold adapts as trading sessions change through the day. Notes and limitations - Never opens, closes or modifies a trade. It only observes and alerts. - The learned baseline resets every time the EA is reloaded; it is not saved between sessions. - Watches up to 30 symbols in one instance. Attach a second instance with a different list if more coverage is needed. - A symbol that has never produced a quote at all (typo, not offered by the broker) is reported as "no data yet" rather than stale - check the symbol name in the Market Watch if a listed symbol never turns green.

Expert advisor · MT4 · v1.0 · Free

About Stale Quote Detector

Stale Quote Detector is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 7 settings, such as Watch symbols, Check interval secs and Frozen threshold secs. MQL source code included.

Files in the download: StaleQuoteDetector.ex4, StaleQuoteDetector.mq4, StaleQuoteDetector.txt.

Settings

SettingDefaultWhat it does
Watch symbolsComma-separated symbols to watch ("" = current chart symbol only)
Check interval secs5Seconds between checks
Frozen threshold secs60Alert when a symbol's last quote is older than this
Baseline samples12Ticks used to learn each symbol's normal gap between quotes before slow-feed alerts start
Slow gap multiple5.0Alert when the current gap exceeds this multiple of the symbol's own average gap
Re alert minutes10Minutes to wait before repeating an alert for a symbol still stuck in the same state
Send push on alertfalseSend a mobile push notification on each new alert (needs MetaQuotes ID set up)

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 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria