KeltnerBandUp
KeltnerBandUp in ProBuilder returns the upper Keltner Channel band, the center line plus the average bar range over N periods. Syntax, formula, examples.
Syntax
KeltnerBandUp[N]Parameters
| Name | Type | Default | Description |
|---|---|---|---|
N | integer | required | Number of bars used for both the moving average of typical price and the average bar range. 14 and 20 are common settings. |
Formula
Center = Average[N]((high + low + close) / 3)
KeltnerBandUp = Center + Average[N](high - low)One period parameter drives both averages, keeping the band self-consistent.
How it works
The upper band takes the channel center, a simple moving average of typical price, and shifts it up by the average height of the last N bars. Tall bars widen the channel, small bars tighten it, so the band adapts to volatility without any standard deviation input. Together with KeltnerBandCenter and KeltnerBandDown it forms a three-line envelope around price.
The offset averages intrabar range only. Overnight gaps do not contribute, which distinguishes this channel from ATR-based variants where true range includes the distance to the previous close. On gap-prone instruments the built-in channel is therefore tighter than an ATR version with the same period.
The function reads the instrument's high, low, and close directly. It accepts no (price) argument and cannot run on a custom series.
Examples
Example 1, Upper band on a chart (Indicator)
// Upper Keltner band over 14 bars
myUpperKeltner = KeltnerBandUp[14]
RETURN myUpperKeltnerPlots the upper boundary of the 14-period Keltner Channel. Adding the center and lower lines completes the envelope.
Example 2, Breakout entry above the band (ProOrder)
// Enter long when the close breaks above the upper band, trail out at the center
upper = KeltnerBandUp[20]
center = KeltnerBandCenter[20]
IF NOT LongOnMarket AND close CROSSES OVER upper THEN
BUY 1 CONTRACT AT MARKET
ELSIF LongOnMarket AND close CROSSES UNDER center THEN
SELL AT MARKET
ENDIFTreats a close beyond the upper band as a momentum breakout and holds the position until price falls back through the channel center.
Example 3, Momentum scan (ProScreener)
// Instruments closing above their upper Keltner band
upper = KeltnerBandUp[20]
excess = 100 * (close - upper) / upper
SCREENER[close > upper](excess AS "Pct above band")Returns instruments trading above the upper band, ranked by how far beyond it they closed.
Interpretation
A close above the upper band means the latest advance is large compared with the average bar of the last N periods. Two readings are possible and context decides between them. In a range, the touch is an overbought extreme that often precedes a rotation back to the center line. In a trend, repeated closes along the upper band are a sign of sustained buying pressure, and fading them is costly.
Channel width, the gap between KeltnerBandUp and KeltnerBandDown, works as a volatility gauge. A narrow channel marks compression that frequently resolves into a directional move.
Common errors and gotchas
- No price argument.
KeltnerBandUp[14](close)raises a syntax error. Only the period is supplied, in square brackets. - Breakout or extreme, not both. A close above the band is a continuation signal in trends and a reversal signal in ranges. Logic that treats every touch the same way tends to backtest poorly across regimes.
- Range-based width. The offset ignores gaps between bars, so the band is tighter than ATR-based Keltner variants on gapping instruments.
AverageTrueRangeallows a gap-aware rebuild. - Mismatched periods. Combining
KeltnerBandUp[14]withKeltnerBandDown[50]yields an asymmetric channel computed on different windows. Use oneNfor all three Keltner functions.
Related instructions
KeltnerBandCenter, the channel's middle line.KeltnerBandDown, the symmetric lower band.AverageTrueRange, gap-aware volatility measure for custom variants.BollingerUp, upper band of the standard deviation based alternative.DonchianChannelUp, upper channel line based on the highest high.TypicalPrice, the(high + low + close) / 3series behind the center line.Average, the smoothing used for both channel components.Highest, maximum of a series over a window, another breakout reference.
