The article presents an MQL5 volume profile built with O(1)-per-tick binning, replacing O(n×m) nested comparisons by direct index arithmetic on a preallocated, tick-size-aligned bin grid. An EA-driven pipeline resolves the session, loads ticks with retries and pre-sizing, aggregates, computes POC/VA, and renders bars in the chart's right margin. A test script verifies arithmetic on controlled datasets.
Volume profile shows a trader where the market actually did business, not merely where price passed through. A candlestick tells you open, high, low, and close for an interval. A volume profile tells you how much volume traded at every price level inside that interval. The price bin with the most volume, the point of control, often draws renewed interest in later price action, though this article does not test that tendency directly. The value area around it marks where the bulk of trading activity actually happened.
Building that profile from raw ticks is expensive if done carelessly. A liquid instrument can generate well over a hundred thousand ticks in a session. Matching each tick against a list of candidate price levels costs O(n × m) work, where n is the tick count and m is the number of price levels. With a few hundred bins, that nested comparison runs into tens of millions of checks. Section 1 measures that cost on a full day of live ticks. The nested loop took 27 to 59 milliseconds per pass, against 1.4 to 3 milliseconds for direct indexing, and the nested loop's cost grows with the bin count while direct indexing's does not.
Not every broker supplies trade volume. On symbols where it is missing, the aggregator counts each tick as one unit, so the profile shows how often price updated at each level instead of how much traded there. Section 11 returns to this limit.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Check out the new article: Building a Volume Profile Aggregator from Tick Data in MQL5.
Volume profile shows a trader where the market actually did business, not merely where price passed through. A candlestick tells you open, high, low, and close for an interval. A volume profile tells you how much volume traded at every price level inside that interval. The price bin with the most volume, the point of control, often draws renewed interest in later price action, though this article does not test that tendency directly. The value area around it marks where the bulk of trading activity actually happened.
Building that profile from raw ticks is expensive if done carelessly. A liquid instrument can generate well over a hundred thousand ticks in a session. Matching each tick against a list of candidate price levels costs O(n × m) work, where n is the tick count and m is the number of price levels. With a few hundred bins, that nested comparison runs into tens of millions of checks. Section 1 measures that cost on a full day of live ticks. The nested loop took 27 to 59 milliseconds per pass, against 1.4 to 3 milliseconds for direct indexing, and the nested loop's cost grows with the bin count while direct indexing's does not.
Not every broker supplies trade volume. On symbols where it is missing, the aggregator counts each tick as one unit, so the profile shows how often price updated at each level instead of how much traded there. Section 11 returns to this limit.
Author: Ushana Kevin Iorkumbul