Skip to content
All library documents

Building a Database-Backed Tick Activity Indicator in MQL5

Article MQL5 articles

Summary

The article develops a BuySellVolume indicator that estimates tick activity from the price change between consecutive ticks divided by elapsed time. Positive price changes contribute to a buyer buffer and negative changes to a seller buffer. It explains how to keep ticks and calculated values in memory, aggregate them into chart bars, and optionally persist and reload historical values through a database interface.

The design separates indicator calculations from database-specific operations using a base class with overridable methods. Derived implementations can connect to SQL Server or SQLite, while the indicator can also run without a database. The article discusses buffering for more efficient writes and shows the intended workflow for loading records into timeframe buffers. Its evidence is an implementation walkthrough and an example linked to EURUSD M5 data, rather than a performance study. The activity measure is a simple price-speed proxy, not traded volume or verified buyer and seller order flow; the document provides no evidence that it predicts returns or improves trading results.

Key ideas

  • Tick activity is approximated as price movement per unit of elapsed time between consecutive ticks.
  • Separate buffers accumulate positive and negative price movements for display as buyer and seller activity.
  • A base class can isolate indicator calculations from database connection, loading, and saving details.
  • Buffering tick records allows periodic database writes, while stored bar values can be reloaded into indicator buffers.
  • The proposed measure is a price-change proxy and does not establish actual aggressor-side volume or predictive value.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.