+1 888 340 6572

# Averages > MovAvg Adaptive Fltr

Article/Author: “A Guide to Smarter Trading”, Perry Kaufman, S&C Magazine, Traders Tips, 03/1998

File Includes:

Function - AMAF

Category: Indicator > Averages

Description:

Everyone wants a short-term, fast trading trend that works without large losses. That combination does not exist. But it is possible to have fast trading trends in which one must get in or out of the market quickly, but these have the distinct disadvantage of being whipsawed by market noise when the market is volatile in a sideways trending market. During these periods, the trader is jumping in and out of positions with no profit-making trend in sight. In an attempt to overcome the problem of noise and still be able to get closer to the actual change of the trend, Kaufman developed an indicator that adapts to market movement. This indicator, an adaptive moving average (AMA), moves very slowly when markets are moving sideways but moves swiftly when the markets also move swiftly, change directions or break out of a trading range.

Usage:

AMA is using the efficiency ratio to adjust the speed of the moving average. In order to construct the AMA, many different qualities of the market must be known. First is the price direction, or the net price change over n days. This is the difference between the price today and the price n days ago. Kaufman uses n of 10 days in Smarter Trading: Direction = Price – price (n) In the accompanying spreadsheet in sidebar Figure 1, the formula to measure price direction is entered in cell D15and copied down to the end of the available data. In Microsoft Excel, it looks like this: = C15-C5The volatility, or noise, is the sum of the absolute values of the daily price changes over n days and is always expressed as positive.

Inputs:

Period - number of bars to average
Pcnt - filter

EasyLanguage Code:
```INPUTS: PERIOD(10), PCNT(.15);
VARS: AMAVAL(0), AMAFVAL(0), AMALS(0), AMAHS(0);

AMAVAL = AMA(PERIOD);
AMAFVAL = AMAF(PERIOD, PCNT);

IF CURRENTBAR = 1 THEN BEGIN
AMALS = AMAVAL;
AMAHS = AMAVAL;
END ELSE BEGIN
IF AMAVAL < AMAVAL[1] THEN
AMALS = AMAVAL;
IF AMAVAL > AMAVAL[1] THEN
AMAHS = AMAVAL;

IF AMAVAL - AMALS > AMAFVAL THEN BEGIN