Trading Tips — Close Location Balance in ProRealTime
A candle can close near its high even when its closing price is below the previous candle's close. These two observations describe different aspects of price behavior. The first concerns where the final transaction price sits within the observed candle range; the second concerns displacement across time. This tutorial develops a ProBuilder indicator that summarizes the first property across a window of completed candles. It is a descriptive measure of closing location, not a measure of actual order flow or a prediction of the next price movement.
Normalize each candle before averaging
For a candle with high H, low L and close C, define its location score as (2C−H−L)/(H−L). Assuming consistent OHLC data and a positive range, the score lies between −1 and +1. A close at the high produces +1, a close at the low produces −1, and a close at the midpoint produces zero. This transformation is equivalent to mapping the fractional position of the close within its range from the interval zero to one onto the interval minus one to one.
Calculate this score separately for each of the most recent N completed candles, then average the valid scores. A candle with a zero range has no meaningful fractional position and is excluded from both the numerator and denominator. The indicator also reports the number of valid candles. If no valid observations are available, the balance is displayed as a neutral placeholder of zero, with a valid count of zero. This distinction prevents an unavailable estimate from being mistaken for genuine balance.

Worked examples and weighting
Set the lookback to three. With highs of 110 and lows of 100, the three closing prices 109, 102 and 106 give individual scores of 0.8, −0.6 and 0.2. The sum is 0.4, and dividing by three gives approximately 0.1333. The valid count is three. If the second candle instead has high, low and close all equal to 102, its range is zero and its score is excluded. The remaining two scores average to 0.5 and the valid count is two.
Consider a separate pair of candles with ranges of one point and ten points. If both close at their respective highs, both receive a score of +1. Each candle receives equal weight regardless of its absolute range. This is intentional: the statistic describes typical relative closing location rather than the total magnitude of directional price movement. A range-weighted variant would answer a different question and should be evaluated separately. All examples in this tutorial are hypothetical.
Complete native ProBuilder indicator
// Close Location Balance - ProBuilder
// Set the lookback to a positive integer.
period = 10
score = 0
valid = 0
balance = 0
// Exclude the developing candle.
IF BarIndex >= period THEN
FOR i = 1 TO period DO
width = High[i] - Low[i]
// Ignore zero-range candles.
IF width > 0 THEN
score = score + (2 * Close[i] - High[i] - Low[i]) / width
valid = valid + 1
ENDIF
NEXT
IF valid > 0 THEN
balance = score / valid
ENDIF
ENDIF
// ValidCount distinguishes neutral from unavailable.
RETURN balance AS "Balance", valid AS "ValidCount"
Implementation details
ProBuilder historical references use square brackets, with offset zero referring to the current bar. The loop begins at offset one and ends at the configured period, so it never reads the developing candle. BarIndex provides a warm-up guard: when its zero-based value is at least the period, the oldest requested offset is available. The score and valid count are initialized on each calculation, preventing accumulation across repeated evaluations. The loop computes the sum of normalized locations and the count of positive-range candles independently.
The RETURN statement publishes both the balance and the valid count. The two series have different units: the first is dimensionless and bounded, whereas the second is a sample count. Depending on chart scaling, the count can visually compress the balance line. Use the data window to inspect the count, or hide its curve through the indicator display settings where supported. A separate count-only indicator is another option if independent scaling is required.
Installation and configuration
Open the ProRealTime indicator editor and create a new ProBuilder indicator named Close Location Balance. Paste the source, save it and add it to a separate chart pane. The period is defined at the top of the example as ten. Change it to three to reproduce the worked example, or expose it as an adjustable variable through the editor and remove the fixed assignment. Use a positive integer and ensure sufficient historical bars are loaded. This source has not been compiled or executed in ProRealTime here; verify syntax and behavior in your installed version before relying on it.
Closed-bar timing and repainting
The value plotted on bar t uses candles t−1 through t−N. It therefore becomes available on the following bar rather than being retrospectively assigned to the last input candle. Ordinary intrabar changes to the current high, low or close do not affect the result. The calculation contains no future references or centered windows and does not intentionally repaint completed observations. Historical data corrections, session changes and reconstructed nonstandard bars can nevertheless change recalculated history. When integrating the output into a scanner or strategy, preserve the same timestamp convention and avoid applying an additional offset unless an additional delay is intended.
Testing and interpretation
Begin with a period of one and verify closes at the high, low and midpoint. Test a zero-range candle and confirm the valid count falls to zero. Next use a period of three and independently calculate the scores from the chart's OHLC values. Observe the indicator during a forming candle, then when a new bar appears. Reload the chart with identical settings and compare historical values. Check that the valid count never exceeds the selected period and that the balance stays within its expected bounds for consistent OHLC data.
A positive reading indicates that valid candles tend to close in the upper portions of their own ranges; it does not establish that prices are trending upward. A sequence of declining candles can still close near their respective highs. The measure ignores candle opens, gaps, volume, spread and the sequence of intrabar transactions. A very narrow candle receives the same weight as a wide candle. Consider a minimum range or minimum valid-count filter if the instrument frequently has sparse price changes, but validate the modified definition independently. Do not interpret a historical association as proof of future trading performance.
For configurable sample filters, separate plots, alerts or ProScreener integration, contact our Custom ProRealTime indicator Development Services.
Risk disclosure: educational material only. Trading involves risk of loss. Hypothetical examples do not establish profitability.