Indicators/probuilder · probacktest · proorder · proscreener

KeltnerBandCenter

KeltnerBandCenter in ProBuilder returns the center line of the Keltner Channel, a moving average of typical price over N bars. Syntax, formula, examples.

Syntax

probuilder
KeltnerBandCenter[N]

Parameters

NameTypeDefaultDescription
NintegerrequiredNumber of bars used for the moving average of typical price. 20 is a common setting. Shorter periods track price more closely, longer periods smooth the line at the cost of lag.

Formula

code
TypicalPrice      = (high + low + close) / 3
KeltnerBandCenter = Average[N](TypicalPrice)

The result is equivalent to Average[N](TypicalPrice) written by hand, packaged as a single call so the three Keltner functions stay consistent.

How it works

On every bar, ProBuilder computes the typical price of each of the last N bars, averages them, and returns the result. Because typical price blends the high, low, and close, the center line reacts to the whole bar rather than the close alone, which makes it slightly smoother than a close-based moving average with the same period.

The center line is one third of the Keltner Channel. KeltnerBandUp adds the N-bar average of the bar range (high - low) to this line, and KeltnerBandDown subtracts it. The channel therefore widens when bars get taller and contracts when they get shorter, adapting to volatility without any standard deviation calculation.

Note that the function reads price data directly from the instrument and timeframe it runs on. There is no (price) argument, so it cannot be applied to a custom series.

Examples

Example 1, Center line on a chart (Indicator)

probuilder
// Center line of the Keltner Channel over 20 bars
myCenterLine = KeltnerBandCenter[20]
RETURN myCenterLine

Computes the 20-bar moving average of typical price and plots it. Overlaid on a price chart it behaves like a smoothed trend reference.

Example 2, Trend filter for entries (ProOrder)

probuilder
// Long only while the close holds above the channel center
center = KeltnerBandCenter[20]

IF NOT LongOnMarket AND close CROSSES OVER center THEN
  BUY 1 CONTRACT AT MARKET
ELSIF LongOnMarket AND close CROSSES UNDER center THEN
  SELL AT MARKET
ENDIF

Uses the center line as a simple regime filter, entering when price reclaims the line and exiting when it loses it.

Example 3, Distance from the center line (ProScreener)

probuilder
center   = KeltnerBandCenter[20]
distance = 100 * (close - center) / center
SCREENER[close > center](distance AS "Pct above center")

Lists instruments trading above their Keltner center line, sorted by how far above it they are in percent.

Interpretation

The slope of the center line summarises the medium-term direction: rising in uptrends, falling in downtrends, flat in ranges. Price holding above the line suggests buyers control the average bar, price below suggests the opposite.

In channel form, the center line is the mean-reversion anchor. Price stretched to KeltnerBandUp or KeltnerBandDown often rotates back toward the center, while repeated closes outside a band signal a strong trend rather than an extreme.

Common errors and gotchas

  • No price argument. KeltnerBandCenter[20](close) is a syntax error. The function always uses the typical price of the current instrument, so only the period goes in square brackets.
  • Not the same as a close SMA. Values differ from Average[20](close) because the input is typical price. Comparisons against a hand-rolled close-based average will not match.
  • Mismatched periods across the channel. Combining KeltnerBandCenter[20] with KeltnerBandUp[50] produces a channel whose lines are computed on different windows. Use the same N for all three functions.
  • Variant confusion. Many platforms define Keltner Channels with an exponential average and an ATR multiplier. The built-in functions use the original definition, a simple average of typical price with range-based bands, so values will not match those variants. A custom ATR version can be built with Average and AverageTrueRange.