Keltner Channels XLThis script plots a Keltner Channel built around a user-selected moving average (EMA or SMA) of price. The upper and lower bands are derived by adding and subtracting a volatility measure, which can be based on ATR, True Range, or a smoothed high–low range.
Trend direction is determined by measuring the percentage change of the basis line over a configurable lookback period. That change is compared against a neutral threshold, which defaults to 0.05%. If the basis rises more than this threshold, it is classified as an uptrend; if it falls more than the threshold, it is classified as a downtrend. If the movement stays within that range, it is treated as neutral, meaning the market is effectively moving sideways.
The basis line is plotted with increased thickness and changes color based on this trend classification. The channel bands and background fill adopt the same color, so the entire channel visually reflects whether the market is trending up, trending down, or consolidating.
Pine Script® 인디케이터






















