azguer

Adaptive Moving Average (AMA)

The Adaptive Moving Average (AMA), also known as Kaufman's Adaptive Moving Average (KAMA), is a trend-following indicator that adapts to market volatility. It was developed by Perry Kaufman in 1972 to improve upon traditional moving averages by making the smoothing period dynamic based on market conditions.

The AMA aims to:

- Smooth out price data to reduce noise, similar to other moving averages.
- Adapt its smoothing based on market volatility and trend strength.

Here's how the Adaptive Moving Average (AMA) works:

1. Calculate the Efficiency Ratio (ER): The AMA begins by calculating the Efficiency Ratio (ER), which measures the efficiency of a price trend. It's calculated as the absolute change in closing prices over a period (`PeriodEfficiencyRatio`) divided by the sum of absolute changes in closing prices over the same period. The ER value ranges from 0 to 1, with higher values indicating a stronger trend.

2. Determine the Smoothing Constant (sc): Using the ER, the AMA calculates the smoothing constant (sc). This constant ranges between a predefined slow EMA (exponential moving average) and fast EMA, depending on the ER.

3. Compute the AMA value: The AMA is then calculated using the smoothing constant (sc) and the previous AMA value, as well as the current close price. This allows the AMA to adapt its smoothing based on the market's volatility.

4. Plot the AMA: The AMA is plotted on the chart, usually as a line, which follows the price action more closely in periods of strong trends and provides more smoothing in periods of lower volatility.

Usage and Interpretation:

- The Adaptive Moving Average can be used to identify trends and potential entry and exit points.
- When the price is above the AMA line, it may indicate an uptrend, and when the price is below the AMA line, it may indicate a downtrend.
- Crossovers of the price with the AMA line can signal potential buy or sell opportunities.
- The adaptability of the AMA makes it more responsive in trending markets and smoother in range-bound markets, providing an advantage over traditional moving averages.

Parameters:

- Period for EfficiencyRatio calculation (`PeriodEfficiencyRatio`):** The period over which the Efficiency Ratio is calculated.
- Fast EMA Length (`fastLength`) and Slow EMA Length (`slowLength`):** These parameters define the range for the smoothing constant. A shorter fast length makes the AMA more responsive, while a longer slow length makes it smoother.

The AMA can be a useful tool in a trader's toolkit for analyzing market trends and making informed trading decisions. Adjusting the parameters can fine-tune the AMA for different trading styles and market conditions.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?