Constants/probuilder · probacktest · proorder · proscreener

TotalPrice

TotalPrice returns the average of the open, high, low, and close of a bar in ProBuilder. Use TotalPrice, or TotalPrice[N] N bars ago, as a smoothed price source.

Syntax

probuilder
TotalPrice

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

How it works

TotalPrice is the mean of the bar's open, high, low, and close, (Open + High + Low + Close) / 4. Of the built-in price constants it draws on the most inputs, so it produces the most balanced single value for a bar, factoring in both endpoints and both extremes.

The bracket offset addresses earlier bars, so TotalPrice[1] is the previous bar's total price. The index must stay within the loaded history.

Because it averages four points, TotalPrice smooths out the effect of any single one. It suits inputs where a stable, representative price per bar is wanted and the individual open or close is less important. On the live bar it can move as the high, low, or close updates, while the open stays fixed.

Examples

Example 1, Total price against its average (Indicator)

probuilder
// Moving average of the total price
ma = Average[20](TotalPrice)
RETURN TotalPrice AS "Total price", ma AS "MA 20"

The indicator plots the OHLC average alongside a moving average of the same series.

Example 2, Screening on total-price strength (ProScreener)

probuilder
// Total price above its 50-bar average
above = TotalPrice > Average[50](TotalPrice)

SCREENER[above] (TotalPrice AS "Total price")

The screener returns instruments whose total price sits above its longer average.

Example 3, Total-price crossover entry (ProOrder)

probuilder
DEFPARAM CumulateOrders = false

fast = Average[10](TotalPrice)
slow = Average[30](TotalPrice)

IF fast CROSSES OVER slow THEN
  BUY 1 CONTRACT AT MARKET
ENDIF

IF fast CROSSES UNDER slow THEN
  SELL AT MARKET
ENDIF

Both averages read TotalPrice, so the crossover uses the full OHLC average of each bar.

Common errors and gotchas

  • Includes the open. TotalPrice is the only built-in average price that folds in the open, so it differs from TypicalPrice, which uses only high, low, and close.
  • Live bar moves. On the current bar the high, low, or close can change, shifting TotalPrice until the bar completes, even though the open is fixed.
  • Offset out of range. TotalPrice[N] fails when N points before the first loaded bar. Guard long lookbacks or load more history.
  • TypicalPrice, the average of high, low, and close.
  • MedianPrice, the average of high and low.
  • WeightedClose, a close-weighted average of high, low, and close.
  • CustomClose, the user-selectable price source.
  • Open, the opening price of a bar.
  • High, the highest price of a bar.
  • Low, the lowest price of a bar.
  • Close, the closing price of a bar.