All free tools

Volatility indicator

Keltner Channels Calculator

Compute the upper and lower Keltner Channels from the EMA basis, the ATR, and a multiplier. The concept, a volatility envelope built from ATR rather than standard deviation, is the part worth understanding.

Upper channel
111.20
Basis (EMA)
108.00
Lower channel
104.80

What Keltner Channels are

Keltner Channels wrap a moving average in an envelope whose width is driven by the Average True Range rather than by standard deviation. The original version dates to Chester Keltner in the 1960s, and the modern form, popularized by Linda Raschke, uses an exponential moving average for the center line and ATR for the band width.

The basis is an EMA of the close, by default over 20 periods. The band width is the ATR, by default over 10 periods, multiplied by a factor, commonly 2. The upper channel is the basis plus that amount and the lower channel is the basis minus it. Because ATR reflects the typical size of recent bars, the channels widen when bars get larger and narrow when they get smaller. This makes Keltner Channels a close cousin of Bollinger Bands, with one key difference: Bollinger Bands measure spread with standard deviation, while Keltner Channels use ATR, which reacts to the full high-to-low range including gaps.

Why Keltner Channels are used

Keltner Channels are used to frame price within a volatility-adjusted band around a trend-following average. Analysts watch how price behaves relative to the channels, note when the bands widen or contract, and sometimes compare them against Bollinger Bands to study volatility from two angles.

The 20/10/2 defaults are conventions, and the right settings depend on the market and timeframe. How you read price against the channels is entirely your own decision.

What are TradingView and Pine Script?

TradingView is one of the most widely used charting and market-analysis platforms, where traders and analysts study price movement across stocks, crypto, forex, and futures on interactive charts. Pine Script is TradingView's own lightweight programming language, created so anyone can build custom tools that run directly on those charts.

People use Pine Script to build four main kinds of tools. Indicators calculate and plot values on the chart, exactly like the calculation above, but recomputed automatically on every bar. Strategies add explicit entry and exit rules and can be backtested against historical data in TradingView's Strategy Tester to see how they would have behaved. Screeners scan many symbols at once for conditions you define. Alerts notify you the moment a condition you specified occurs, so you do not have to watch the screen.

The value is precision and automation. Instead of eyeballing a chart, you describe exactly what you want measured, visualized, or notified about, and TradingView runs it consistently across any market and timeframe. That is why traders, analysts, and developers write Pine Script: it turns a manual charting idea into a repeatable tool. These tools are for tracking, visualizing, and testing market ideas; they do not tell you what to trade, and that decision always remains yours.

Writing that code by hand means learning Pine Script's syntax, its type system, and the exact names of hundreds of built-in functions. It is a real programming language, and small mistakes stop a script from compiling in the Pine Editor.

Turn this into Pine Script

This calculator gives you one set of channel values. On a chart the three lines recalculate every bar and are usually drawn with a shaded fill between them. Pine Script builds them from an ta.ema basis and an ta.atr range in a few lines, but the plotting, fills, and any breakout or squeeze logic around them still need to be written.

Pine Script v6
//@version=6
indicator("Keltner Channels", overlay=true)

basis = ta.ema(close, 20)
rng   = ta.atr(10)
upper = basis + 2 * rng
lower = basis - 2 * rng

plot(basis, "Basis", color=color.orange)
p1 = plot(upper, "Upper", color=color.blue)
p2 = plot(lower, "Lower", color=color.blue)
fill(p1, p2, color=color.new(color.blue, 90))

PineScripter is an AI built specifically for Pine Script. You describe what you want in plain English and it writes TradingView-ready v5 or v6 code. Because it is specialized on the Pine Script language and its exact function signatures, it tends to produce code that compiles far more reliably than general-purpose models like ChatGPT, which often invent functions that do not exist in Pine Script.

Related free calculators

From the blog

PineScripter is an AI developer tool that helps you write Pine Script code. It is not a financial advisor and will never offer financial, investment, or trading advice. Everything on this page, including the calculator and the explanations, is provided purely for educational and informational purposes. Any decision about how to interpret an indicator or trade a market is entirely your own. See our full disclaimer for more.