All indicators

kama

Mar 23, 2023

Static chart image
SignalsCycleMoving Averages

The kama indicator provides an adaptive moving average that adjusts its sensitivity based on market volatility and trend efficiency to filter noise and identify trends more effectively. By incorporating a Dominant Cycle calculation, this tool optimizes the lookback period dynamically, allowing it to stay close to price action during strong trends while flattening out during choppy market conditions.

Usage

The Usage section describes how the script can be used to identify market direction and potential entry points. The indicator primarily functions as a trend-following tool where the slope and color of the KAMA line indicate the current market bias.

  • Trend Identification: A green KAMA line moving upward suggests a bullish trend, while a red KAMA line moving downward suggests a bearish trend.
  • Hysteresis Band: The optional hysteresis bands provide a buffer zone around the moving average. This helps traders avoid "whipsaws" or false signals that occur when price fluctuates narrowly around the mean.
  • Bar Coloring: When enabled, the chart bars change color to match the KAMA trend, providing a visual confirmation of the current momentum.
  • Signals: Traders often look for price crossovers or changes in the KAMA direction as potential signals for long or short positions.

Details

The script implements Kaufman's Adaptive Moving Average (KAMA) but modifies the standard Efficiency Ratio (ER) calculation. While the original KAMA uses a fixed period for ER, this version utilizes John F. Ehlers' Dominant Cycle algorithm to determine the ideal lookback period.

The execution process follows these steps:

  1. Filtering: A High-Pass filter removes cyclic components shorter than the specified period, followed by a Super Smoother filter to reduce noise.
  2. Correlation: A Pearson correlation is applied across multiple lags to identify cyclical patterns in the data.
  3. Dominant Cycle: The script calculates the Center of Gravity of the spectrum to find the dominant market cycle, constrained between 8 and 14 periods.
  4. KAMA Smoothing: The Efficiency Ratio is derived using this dynamic cycle length. This ratio determines the smoothing constant, which scales between a "fast" and "slow" exponential moving average speed.

Settings

The settings are categorized to allow fine-tuning of the adaptive logic and visual output:

  • Length: Sets the maximum lookback period for the correlation calculations.
  • Fast Length: The period for the fastest EMA used in the smoothing constant calculation (usually 2).
  • Slow Length: The period for the slowest EMA used in the smoothing constant calculation (usually 30).
  • High-Pass Period: The cutoff period for the High-Pass filter to remove low-frequency noise.
  • Source: The price data used for calculations (default is ohlc4).
  • Hysteresis: Toggles the visibility of the buffer bands around the KAMA line.
  • Bar Color: Toggles whether the price bars should be colored based on the KAMA trend direction.

FAQ

How do I interpret the color changes in the KAMA line? A change from red to green indicates that the adaptive average has started sloping upward, suggesting a potential shift to a bullish trend. Conversely, a change from green to red suggests a bearish shift.

What is the benefit of using the Dominant Cycle instead of a fixed period? Market cycles are constantly changing; a fixed period may be too slow for fast markets or too reactive in slow ones. The Dominant Cycle allows the indicator to adapt its lookback period to the current rhythm of the market.

How can I access the kama indicator? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.