Constants/probuilder · probacktest · proorder · proscreener

Volume

Volume returns the traded volume of a bar in ProBuilder. Use Volume, or Volume[N] for the volume N bars ago, to gauge activity in indicators, screeners, and strategies.

Syntax

probuilder
Volume

Volume[N] returns the traded volume N bars back, where N is 0 for the current bar, 1 for the previous bar, and so on. Volume and Volume[0] are equivalent.

How it works

Volume reports how much was traded during a bar on the chart's working timeframe. It is a size measure, not a price, so it is used to judge the strength or conviction behind a price move rather than the move itself.

The bracket offset addresses earlier bars relative to the one being processed. Volume[1] is the previous bar's volume and Volume[10] is the volume ten bars ago. The index must stay within the loaded history, otherwise an error is raised.

Volume feeds many technical tools directly, and it accepts averaging like any price series, for example Average[50](Volume). On the live bar volume accumulates as trades occur, so it grows until the bar completes. Not every instrument reports volume, and some feeds provide only estimated or tick-based figures.

Examples

Example 1, Volume against its average (Indicator)

probuilder
// Ratio of current volume to a 50-bar average volume
avgVol = Average[50](Volume)
ratio = Volume / avgVol
RETURN ratio AS "Volume ratio", 1 AS "Average line"

The indicator shows how the current bar's volume compares with its recent typical level.

Example 2, Screening for a volume surge (ProScreener)

probuilder
// Latest volume at least double the 20-bar average
surge = Volume > 2 * Average[20](Volume)

SCREENER[surge] (Volume AS "Volume")

The screener returns instruments where the current bar's volume ran well above normal.

Example 3, Volume-confirmed breakout (ProOrder)

probuilder
DEFPARAM CumulateOrders = false

level = Highest[20](High)[1]
avgVol = Average[20](Volume)

// Require both a price breakout and above-average volume
IF Close > level AND Volume > avgVol THEN
  BUY 1 CONTRACT AT MARKET
ENDIF

SET STOP %LOSS 2

The entry fires only when the breakout is accompanied by higher than average Volume.

Common errors and gotchas

  • Not every instrument has volume. Some markets and data feeds report no volume, leaving Volume at 0. Test the instrument before relying on volume conditions.
  • Live bar accumulates. On the current bar volume builds up over time and is only complete at bar close, so comparisons against a full historical bar are uneven until the bar finishes.
  • Estimated figures. Certain feeds supply estimated or tick-count volume rather than exact traded size, which can differ from official exchange totals.
  • Close, the closing price of a bar.
  • Open, the opening price of a bar.
  • High, the highest price of a bar.
  • Low, the lowest price of a bar.
  • TypicalPrice, the average of high, low, and close.
  • CustomClose, the user-selectable price source.
  • Range, the high minus low of a bar.
  • MedianPrice, the average of high and low.