Keltner Channel Breakout (Breakout)
Buys when price breaks above the upper Keltner Channel (20-bar EMA plus 2 average true ranges) and sells when it falls back below the channel midline.
How It Works
- Compute a 20-bar EMA midline and the average bar range (a 20-bar EMA of close-to-close moves); the upper channel sits 2 average ranges above the midline.
- Buy when the close breaks above the upper channel — price has escaped its normal envelope with unusual force.
- Sell when the close falls back below the midline — the thrust has faded back to average.
Worked example. The 20-bar EMA is 100 and the average bar range is 1.5, putting the upper channel at 103. A strong close at 103.6 breaks above it — buy. The trade rides the move until a close at 104.8 slips under the midline, which has by then risen to 105.
The Math Behind The Indicators
Everything runs on closing prices of the traded timeframe: P is a close, Pt today's close, and N counts bars — one bar is one candle of that timeframe, so 20 bars on a 1h chart is 20 hours.
- Exponential Moving Average (EMA)
- A running average that blends each new close into yesterday's value, so old prices fade away gradually instead of dropping out all at once. The blend factor α is larger for shorter periods, which makes short EMAs faster to react.
- Example: With N = 19, α = 2 / 20 = 0.1. If yesterday's EMA was 100 and today's close is 110, the new EMA is 0.1·110 + 0.9·100 = 101 — it moves toward the new price but keeps most of its history.
- Average Range (ATR)
- How much price typically moves per bar. These backtests run on closing prices, so each bar's range is the absolute close-to-close change, and the ATR is the average of the last N ranges. It sizes stops: a stop placed k ATRs away automatically adapts to how volatile the market currently is.
- Example: If the last three close-to-close moves were +2, −1 and +3, the ranges are 2, 1, 3 and the 3-bar ATR is 2. A stop 2 ATRs below an entry at 100 then sits at 96.