Loading…

News Window Tick Jump Sampler

"The spread widened during the release" is common knowledge; how large the single worst tick-to-tick jump actually was, in points, is the number that determines whether a stop placed at a given distance would have survived it - and that is a different, sharper question than reading it off a one-minute candle's high-low range, since a candle range can be built from several smaller moves rather than one violent jump. This script answers that question directly. Given a start time and a window length, it waits for the window (bounded, so a mistyped or already-passed time cannot hang the script indefinitely), then samples every Bid tick inside the window and tracks the single largest absolute jump between two consecutive ticks, in points, along with when it happened and what the price moved from and to. It also counts how many individual jumps crossed a user-chosen alert threshold and reports the average absolute jump size across the whole window. Leaving the start time blank samples immediately, which is useful for testing the script's mechanics, or for watching a window whose start is being judged by eye rather than by a scheduled time. Notes and limitations - Only the current chart's symbol is watched, and only the Bid stream. - The window start time is compared against server time (TimeCurrent), which must be correct on the broker's side for the wait to land where intended. - The wait phase itself is bounded by InpMaxWaitMinutes - if that limit is reached before the window opens, the script alerts and exits without sampling anything. - The script occupies the calling thread for the whole wait-plus-sample duration and cannot run in the background the way an indicator or expert can.

Script · MT5 · v1.0 · Free

About News Window Tick Jump Sampler

News Window Tick Jump Sampler is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 6 settings, such as Window start time, Window minutes and Max wait minutes. MQL source code included.

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

Settings

SettingDefaultWhat it does
Window start timeEvent window start, server time, "YYYY.MM.DD HH:MM" ("" = start immediately)
Window minutes5How long the event window lasts, minutes
Max wait minutes240Give up waiting for the start time after this many minutes
Jump alert points100A single-tick jump at or above this many points counts as a "large" jump
Poll interval ms20Poll frequency for new ticks, milliseconds
Save csvtrueWrite every tick jump inside the window to a CSV

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: News Trading · Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria