The Adaptive Moving Average (AMA) study is similar to the exponential moving average (EMA), except the AMA uses a scalable constant instead of a fixed constant for smoothing the data.
The formula for the exponential moving average is:
EMA(today) = C*(price(today) – EMA(yesterday)) + EMA(yesterday)
C is a smoothing constant where C = 2/(N+1), and N is a number used to approximate a simple moving average. C ranges between 0 and 1. For example, to use an EMA with similar characteristics to a 10-bar simple moving average, use N= 10. Therefore, C = 2/(10+1) = 2/11 = 0.1818.
The formula for the AMA is:
AMA(today) = SC*(price(today) – AMA(yesterday)) + AMA(yesterday)
Where SC = Scalable Constant
The AMA uses two constants based on a fast EMA (short look back period) and a slow EMA (long look back period). The scalable constant, which has a range between 0 and 1, weights the AMA calculation between the two exponential moving averages by adjusting the constant. This weighting is based on the degree of market direction relative to market volatility. The higher the degree of trending by the market, the more the weighting shifts to the fast exponential moving average constant. If the market is moving in congestion, then the weighting shifts to the slow exponential moving average constant.
The scalable constant uses a market Efficiency Ratio to determine the degree of trend by the market. The ratio is direction relative to volatility.
Direction is the difference between the current bar’s close and the close N bars back.
Volatility is the difference between each close over N bars back. The absolute value of each difference is summed:
ER =Abs(Direction/Volatility) where,
Direction = Price(today) – Price(N bars back)
and
Here, the volatility measurement is the sum of the absolute value of the one bar difference in closes over the look back period N. The default for N is 10 bars.
If the direction and the volatility readings are similar (i.e., the market is trending), the ratio approaches 1. If the direction and the volatility readings are not similar (i.e., the market is in congestion), the ratio approaches 0.
The Efficiency Ratio is used to scale between the two constants from the two exponential moving averages (fast and slow). The default values are 2-bar and 30-bar EMAs. Therefore, the default constants are as follows:
Fast = 2/(2+1) and Slow = 2/(30+1)
Fast = 0.6667 and Slow = 0.0645
The formula for weighting or scaling the constant is as follows:
ER*(Fast – Slow) + Slow or the default version is ER*(0.6667-0.0645) - 0.0645
As stated earlier, if the market is trending, then ER approaches 1 and the scalable constant is weighted towards the Fast constant in the formula above. If the market is in congestion, then ER will approach 0 and the scalable constant is weighted towards the Slow constant.
Finally, the result from the formula above is squared.
SC = (ER*(Fast – Slow) + Slow)2
This causes the AMA to go flat when the market is in congestion because the ER approaches zero and the resulting smoothing constant is a very small number.
Adaptive Moving Average Parameters
Description | |
Display |
Opens sub-window to set parameters • Color = Line color. • Weight = Line thickness. • ShareScale = Determines whether sharing of the vertical scales between studies is accepted. Auto = System determine whether sharing is feasible. On = Scale is shared regardless of the functions and studies displayed. Off = Scale is not shared. ShareScale must be On if study is overlaid on a study with multiple outputs. ShareScale must be On if study is overlaid on a study with multiple outputs. |
MarkIt |
Opens Specify Conditions window. |
Offset |
Distance in bars between the current bar and the bar to use in the calculation. A positive offset uses future bars. A negative offset uses past bars. For example: 1 = next bar -2 = two bars back from current bar |
ER Period |
Number of days used to calculate the Efficiency Ratio (direction/volatility ratio). |
Fast Period |
Value used to calculate the smoothing constant for the fast EMA. smoothing constant = 2/N+1, where N is the fast period |
Slow Period |
Value used to calculate the smoothing constant for the slow EMA. smoothing constant = 2/N+1, where N is the slow period |
Price |
Determines the price used in the calculation. |