Indicators: The class for drawing the AMA using the ring buffer

 

The class for drawing the AMA using the ring buffer:

The class is designed for calculation of the technical indicator Adaptive Moving Average (Adaptive Moving Average, AMA) using the algorithm of the ring buffer.

The result of the work of the Test_AMA_OnValueRB.mq5 with the size of the ring buffer of 256 elements

Author: Konstantin Gruzdev

 

Forum on trading, automated trading systems and testing trading strategies

Indicators: AMA_STL_HTF

newdigital, 2014.07.13 12:00

Adaptive Moving Average

Adaptive moving average (AMA), as the name suggests is an adaptation of moving average. It is designed to adapt according to the dynamic market as needed.

----

Simple moving average (SMA) and its cousins weighted moving averages (WMA) and exponential moving averages (EMA) all work fantastic when the market is trending. However when the market is range bound they pick up a lot of market noise generating a lot of premature signals. Moreover, they are all inherently lagging in nature.

In a quest to remedy shortcomings of moving averages, Perry J. Kaufmann, first introduced adaptive moving average in his book The Smarter Trading: Improving Performance in Changing Markets.

20-Day-SMA & AMA In Action:



Prior to Mr. Kaufmann's introduction of AMA, traders employed combination of more than a single moving average such as The Double Crossover Method and The Triple Crossover Method.

The reasons behind employing multiple combination of moving averages are based on the following facts:

  1. Fast moving averages, which often consists of shorter time period such as 5-day period performed best when the market is rapidly trending.
  2. Slow moving averages, which often consists of longer time period such as 50-day period performed best when the market is range bound thereby filtering most of the noise in the market.

So the genius in Kaufmann's AMA was a system smart enough to vary its speed according to a combination of market direction and speed.

In another words, when the market is trending, AMA speeds up along with the trend. When the market is range bound and does nothing AMA slows down.

Thus it righteously earns the name "adaptive" as it self adjusts to market direction and speed.

Kaufmann's AMA achieves sense of market direction and speed by incoporating the efficiency ratio.

Adaptive Moving Average Trading Rules

Following are the trading rules for the Adaptive Moving Average:

  1. Buy when the AMA turns up
  2. Sell when the AMA turns down