stratester.com

Indicators · condition block

Keltner Channel

The Keltner Channel block draws a band around an exponential moving average, with a width set by ATR, and fires when the close lands outside it. It is smoother than Bollinger Bands because ATR changes more slowly than a standard deviation.

How the engine evaluates it

The middle line is an EMA of closes with the EMA length. The bands are the middle line plus and minus multiplier × ATR, with ATR (Wilder) using its own length.

above kc_upper fires while the close is strictly above the upper band; below kc_lower while it is strictly below the lower band. Before your start date the engine loads extra history (at least 50 candles, up to 5,000, scaled to the longest indicator in the bot) so the indicator has settled by the first candle of the run.

Formula
mid = EMA(close, EMA length)
upper = mid + m × ATR(ATR length)
lower = mid − m × ATR(ATR length)

Botscript syntax

In the Lab you pick this block from the Indicators group and fill in its fields. In the code view the same condition is written like this:

price below kc_lower(20,10,1.5)
price above kc_upper(20,10,1.5)

Settings

SettingValuesDefaultNotes
Bandabove upper, below lowerbelow lower—
EMA length1 – 5,00020—
ATR length1 – 5,00010—
Multiplier0 – 1001.5Band width in ATRs.
Timeframethe run's candles, or 15m, 30m, 1h, 2h, 4h, 6h, 12h, 1d, 1wthe run's candlesOptional. At least the run's candle size and a whole multiple of it.

On a higher timeframe

Add a timeframe at the end to read Keltner Channel from bigger candles than the run uses, for example price below kc_lower(20,10,1.5) on 4h. The engine builds those candles from the run's own candles (UTC, weeks start on Monday) and evaluates the block only on candles that have closed, so there is no look-ahead. Lengths and lookbacks count the bigger candles.

Keltner Channel is a state on a higher timeframe: the result from the last completed bigger candle holds on every run candle until the next one closes.

The timeframe must be at least the run's candle size and a whole multiple of it; otherwise the run stops with an error and is not charged. Multi-timeframe conditions covers the details, including warm-up.

How traders use it

  • Trend breakouts: a close above the upper band.
  • Pullbacks: a close below the lower band inside a larger uptrend.
  • Squeeze: Bollinger Bands inside the Keltner Channel mark unusually low volatility.

Example bot

botscript
bot "Keltner Breakout"

when price above kc_upper(20,10,1.5)
then buy 100%

when price below kc_lower(20,10,1.5)
then sell 100%
  • Buys when the close breaks above the upper Keltner band.
  • Sells when it falls below the lower band.

Pitfalls

  • Narrow multipliers produce frequent signals in noise.
  • Like every band, a strong trend can keep price outside the band for a long time.

Keltner Channel: frequently asked questions

Keltner or Bollinger?

Keltner bands use ATR and move smoothly; Bollinger bands use the standard deviation of closes and react faster to volatility changes.

What are the three numbers?

EMA length, ATR length and the ATR multiplier.

Is the midline an SMA?

No, an EMA, as in the modern (Linda Raschke) version of the channel.

Does a wick outside the band count?

No, only the close.

Simulated results are hypothetical. They include only the fee and slippage you set on the bot, not every real-world cost or market condition, and past performance does not guarantee future results. Nothing here is financial advice.