Skip to content
All library documents

Building a Volume Profile from Candle Closes in MQL5

Article MQL5 articles

Summary

This article describes an MQL5 indicator that visualizes how volume is distributed across price levels over a selected lookback. It retrieves candle highs, lows, closes, times, and volume through copy functions, preferring tick volume and falling back to real volume. The price range is divided into bins, and each candle’s volume is assigned to the bin containing its close. Bin totals are normalized to scale chart rectangles, while sufficiently active bins are marked with horizontal Point of Control levels.

The implementation also covers placing objects relative to bars, updating them as new data arrives, and cleaning up only objects belonging to the indicator. The approach makes several simplifying choices: volume is assigned using the close rather than distributed across each candle’s traded range, and the described POC threshold determines which bins receive lines. The article gives an implementation design and code structure, but no trading performance evidence; a displayed volume profile is a descriptive tool, not proof that a price level will act as support or resistance.

Key ideas

  • The indicator assigns each candle’s volume to a price bin according to its close.
  • It prefers tick volume and uses real volume as a fallback when needed.
  • Normalized bin totals determine rectangle widths, while selected high-volume bins receive POC lines.
  • Chart objects are positioned by bar offsets and managed with an indicator-specific prefix.
  • The profile describes activity under its binning assumptions and does not establish future price reactions.

Tags

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