Volatility

Keltner Channel Buy Sell Signals - TradingView Guide

Read Keltner breakout, return-inside and compression conditions. Inspect a Pine Script example with EMA 20, ATR 10 and closed-bar signals.

Keltner Channel Signal Interpretation

Quick-reference guide to 7 signal types you will see on the chart.

Signal TypeIndicator ConditionMarket MeaningInterpretation limits
Upper-band breakoutPrevious close at or below its upper band; current close above its band.A new upper-boundary crossing under this calculation.Does not establish continuation.
Lower-band breakoutPrevious close at or above its lower band; current close below its band.A new lower-boundary crossing.A gap can trigger the condition.
Return inside from aboveClose crosses below the upper band and remains at or above the lower band.The close has re-entered the channel.Not evidence that the middle line will be reached.
Return inside from belowClose crosses above the lower band and remains at or below the upper band.The close has recovered into the channel.The wider trend may remain downward.
Width contractionCurrent channel width is below 70% of its 20-bar average.An illustrative relative-width threshold.Does not predict expansion timing or direction.
Three closes above upper bandThe latest three closes are each above their own upper band.A persistent outside-band condition, not a new crossing.Can remain active on consecutive bars.
Baseline crossingClose crosses the EMA baseline in either direction.Price changed sides relative to a moving reference.Sideways markets can produce repeated crosses.

Keltner Channel Pine Script Signal Code

Educational indicator example. Review its exact rules and compare its plots with your intended calculation in TradingView. It does not place orders or establish profitability.

Pine Script v6
//@version=6
indicator("Keltner Channel Buy Sell Signals", overlay=true)

// Input parameters
length = input.int(20, "Channel Length", minval=1)
mult = input.float(1.5, "ATR Multiplier", minval=0.1)
atrLength = input.int(10, "ATR Length", minval=1)
src = input.source(close, "Source")

// Keltner Channel calculation
basis = ta.ema(src, length)
atrValue = ta.atr(atrLength)
upper = basis + atrValue * mult
lower = basis - atrValue * mult

// Mean reversion signals
returnFromBelow = ta.crossover(close, lower)
buyMR = barstate.isconfirmed and returnFromBelow and close <= upper
returnFromAbove = ta.crossunder(close, upper)
sellMR = barstate.isconfirmed and returnFromAbove and close >= lower

// Breakout signals
buyBO = barstate.isconfirmed and close > upper and close[1] <= upper[1]
sellBO = barstate.isconfirmed and close < lower and close[1] >= lower[1]

// Band squeeze detection
channelWidth = upper - lower
avgWidth = ta.sma(channelWidth, 20)
squeeze = barstate.isconfirmed and channelWidth < avgWidth * 0.7

// Trend strength - price riding the band
ridingUpper = barstate.isconfirmed and close > upper and close[1] > upper[1] and close[2] > upper[2]

// Middle line cross
bullCrossRaw = ta.crossover(close, basis)
bullCross = barstate.isconfirmed and bullCrossRaw
bearCrossRaw = ta.crossunder(close, basis)
bearCross = barstate.isconfirmed and bearCrossRaw

// Plot Keltner Channel
plot(basis, "Middle Line", color=#2962FF, linewidth=1)
uPlot = plot(upper, "Upper Band", color=#FF5252, linewidth=1)
lPlot = plot(lower, "Lower Band", color=#4CAF50, linewidth=1)
fill(uPlot, lPlot, color=color.new(color.gray, 90), title="Channel Fill")

// Plot signals
plotshape(buyBO, "Breakout Buy", shape.triangleup, location.belowbar, color=#00C853, size=size.small)
plotshape(sellBO, "Breakout Sell", shape.triangledown, location.abovebar, color=#FF1744, size=size.small)
plotshape(buyMR, "MR Buy", shape.labelup, location.belowbar, color=#2979FF, size=size.small)
plotshape(sellMR, "MR Sell", shape.labeldown, location.abovebar, color=#FF9100, size=size.small)

plotshape(ridingUpper, "Three closes above upper", shape.square, location.top, color=color.blue, size=size.tiny)

// Squeeze label
plotshape(squeeze, "Squeeze", shape.circle, location.top, color=#E040FB, size=size.tiny)

// Alert conditions
alertcondition(buyBO, "Keltner Breakout Buy", "Price broke above Keltner upper band")
alertcondition(sellBO, "Keltner Breakout Sell", "Price broke below Keltner lower band")
alertcondition(buyMR, "Keltner MR Buy", "Price closed back inside channel from lower band")
alertcondition(sellMR, "Keltner MR Sell", "Price closed back inside channel from upper band")
alertcondition(squeeze, "Keltner Squeeze", "Keltner Channel squeeze detected - volatility contraction")
alertcondition(bullCross, "Keltner Bullish Cross", "Price crossed above Keltner middle line")
alertcondition(bearCross, "Keltner Bearish Cross", "Price crossed below Keltner middle line")

Example settings for Keltner Channel

Record the inputs used by the example. These settings are not an optimized trading recommendation.

Feature comparison table: Default vs Description
ParameterDefaultDescription
Channel Length20EMA length for the baseline. It changes the center; width at a given bar is controlled separately by ATR and the multiplier.
ATR Multiplier1.5Each band is this multiple of ATR away from the baseline. This illustrative input is not an optimized setting.
ATR Length10Lookback for Wilder ATR. Match it when comparing another Keltner implementation.
SourceCloseInput to the EMA baseline. Changing to HLC3 or OHLC4 changes the average; neither estimates executable fills.

Turn the condition into an explicit rule

Specify the calculation, confirmation time, entry and exit rules before asking Pineify to draft or revise Pine Script. Review the code and simulate realistic costs before evaluating a strategy.

Explore Pine Script coding

FAQ

Keltner Channel Signals FAQ

Which Keltner settings does this example use?
EMA 20, ATR 10 and a 1.5 multiplier. They define this example only. Changing the EMA length moves the center without directly changing the ATR width. Compare parameter choices on separate validation periods with costs before selecting a strategy.
How can I check a return-inside signal?
As a hypothetical example, let the prior lower band be 100 and prior close 99, then the current lower band be 100, upper band 104 and close 101. The close crossed above the lower band and remains inside, so the return-from-below condition is true. A current close of 105 would fail the inside-channel test.
Do these signals change before the bar closes?
The bands move while the current bar develops. This example gates plotted signal conditions with barstate.isconfirmed; it waits for the closing update. That does not eliminate effects from changed inputs, revised data or different chart history. Use standard candles and matching settings.
How does Keltner width differ from Bollinger width?
This example uses an ATR offset around an EMA. Bollinger Bands commonly use a standard-deviation offset around an SMA. Those formulas respond differently to price paths and gaps; neither formula alone proves fewer false signals.
Does a narrow channel predict a breakout?
No. The script flags width below 70% of its recent mean as an explicit example threshold. That condition can persist. It does not specify an entry, stop, target, future direction or expected win rate.
How do I create alerts or evaluate a strategy?
Add the example to the matching TradingView chart and create an alert for one of its named conditions, using Once Per Bar Close. Existing alerts retain a saved script and input configuration; recreate them after relevant changes. This indicator has no orders or backtest results. A separate strategy needs entry, exit, position-size and cost rules.