Loading…

Tick Feature Extractor

MQL4 has no genuine per-tick callback with tick-level detail - only OnTick(), fired once per incoming quote, with no history of the ticks that led up to it. A tool that wants "how many ticks landed on this bar", "is price currently trending or chopping tick to tick", or "is this a burst of rapid ticks or a quiet stretch" has to reconstruct all of it itself from consecutive OnTick() calls, and a naive version that just re-reads iTickVolume(_Symbol, _Period, 0) every tick throws away direction and burst information entirely - it only ever answers "how many", never "which way" or "how fast". This library keeps genuine running state across calls: every Update() compares the new Bid against the previous one to classify the tick as up, down or flat, extends or breaks a directional run accordingly (a flat tick breaks a run without itself starting a new one - it carries no direction to continue), and tracks the longest up-run and down-run seen so far this bar. A small time-stamped ring buffer independently tracks a trailing ticks-per-second burst score over a configurable window, so a sudden flurry of ticks is visible as a number, not just a gut feeling from watching the chart. Deliberately built on iTickVolume() rather than iVolume(), per this catalogue's house style. Notes and limitations - Features are derived from Bid movement between consecutive Update() calls, not from genuine exchange-level tick data - MQL4 gives no finer granularity than one OnTick() call per incoming quote, so this is the finest resolution actually available on the platform. - barRangeSoFar is the running high-low of Bid values seen THIS bar, not the chart's own High[]/Low[] - it only reflects prices that produced an OnTick() call while this library was attached and running. - Current() reflects a still-forming bar and can still change on the next tick; use Previous() for any logic that must only act on a provably finished bar's final numbers. - The burst-score ring buffer has a fixed capacity (capacityHint at Init()) - an extremely high tick rate that exceeds it within the burst window will still compute a rate, just from whatever ticks are still held in the ring rather than every tick that ever arrived.

Script · MT4 · v1.0 · Free

About Tick Feature Extractor

Tick Feature Extractor is a script for MetaTrader 4. MQL source code included.

Files in the download: TickFeatureExtractor.mqh, TickFeatureExtractor.txt, TickFeatureExtractorDemo.mq4.

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: Buy/Sell Arrows · Trend · Trailing Stop & Break-even · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria