The challenge with volume displayed as a plain histogram is that raw numbers lack context. Traders often glance at the default MetaTrader bars and must decide by eye whether a spike is meaningful. This article shows how to replace that guesswork with a compact visual signal: a series of volume bubbles drawn above candles that scale with recent activity. By applying a statistical baseline based on the mean and standard deviation, the indicator converts raw counts into a normalized score.
The result is an intuitive map of market participation that adapts to changing conditions and helps confirm moves or flag suspiciously weak breakouts.
Before examining the algorithm, it helps to understand what data MetaTrader provides. There are two primary volume types: tick volume and real volume. Tick volume counts price updates during a bar and is commonly used in forex where centralized trade tallies are unavailable. Real volume reports actual contracts or units and is available for centralized exchanges like futures and stocks. This guide focuses on environments where tick volume is the practical input, but the approach is fully compatible with real volume where supplied. We will also rely on the platform’s built‑in arrays and the indicator lifecycle function similar to OnCalculate.
Table of Contents:
Why a normalized volume view matters
Raw volume spikes have meaning only when compared to a recent background level. A count of 2,000 ticks could be exceptional on a quiet pair or mundane during a news surge. Normalization builds that context: compute a rolling mean over a chosen lookback window and measure variability via standard deviation. Expressing current volume in units of standard deviations yields a unitless score that tells you how unusual the reading is. This method reduces noisy judgments, producing a reproducible threshold for what constitutes “high” or “low” participation. Traders can then attach rules—such as requiring a breakout to coincide with a bubble above a certain normalized threshold—to improve signal reliability.
How the volume bubble indicator works
Data inputs and expectations
The indicator uses a sliding window parameter (for example, N bars) to define “recent” activity. Within that window you compute the mean of the chosen volume array and then the sample variance and standard deviation. The algorithm must check that the instrument has at least N bars available to avoid invalid calculations. Implementation leverages the platform’s chart arrays so the indicator runs in real time whenever ticks arrive. Treat the chosen N as a tuning knob: larger values smooth the baseline across longer regimes; smaller values make the indicator more responsive to abrupt shifts.
Algorithm steps
Once the standard deviation is available, the indicator converts each candle’s raw volume into a normalized value by dividing the volume by the standard deviation. This yields an easily comparable score measured in sigma units. The next step maps that score into a visual size: define discrete ranges (for example, 0–1, 1–2, 2–3, etc.) and assign a corresponding bubble size for each range. These sizes are then plotted above the candle as simple text symbols or graphical objects. A stable implementation also handles the degenerate case where standard deviation is zero by skipping rendering until variability resumes.
Sizing rules and color logic
Bubble appearance conveys two dimensions: magnitude and direction. Magnitude comes from the normalized score mapped to font size or object scale, while direction uses color to indicate whether the current volume rose versus the prior bar. For example, choose a green tint when volume increases and an amber tint when it falls. Optionally show an exact numeric label on extreme readings. Drawing can rely on persistent object names derived from bar timestamps so the chart remains tidy during updates.
Practical benefits and trading use cases
Visually summarized volume reduces cognitive overhead and makes pattern confirmation faster. Use the volume bubble to validate breakouts: a price breakout accompanied by a large bubble signals strong participation and increases confidence in continuation. Conversely, a breakout with small bubbles warns of potential failure. The indicator is also useful to detect divergence between price momentum and participation, for example when prices rally while bubble sizes shrink. Because the method normalizes to local behavior, it adapts across different asset classes—forex pairs, indices, commodities, and crypto—so you can apply the same logic without rewriting thresholds for every instrument.
From an engineering perspective, build the indicator stepwise: validate data length, compute mean and standard deviation, normalize volumes, map to sizes and colors, and then draw or update objects safely on the chart. Test across timeframes and market conditions to ensure robustness. The final product transforms opaque histograms into an actionable, context‑aware visual tool that helps traders focus on execution rather than interpretation.
