Fractal Adaptive Moving Average (FAMA) was authored by John Ehlers. The FAMA averages the differences of highest highs and lowest lows over different parts of the period length. These values are mathematically massaged with boolean questions, natural logarithms and Euler’s numbers, and, with some feedback from the former FAMA, the current FAMA is finally formed. The user may change the input (midpoint) and period length. This indicator’s definition is further expressed in the condensed code given in the calculation below. Fractal Adaptive Moving Average is a trend indicator and may be used in conjunction with other studies. No trading signals are calculated.

### How To Access in MotiveWave

or go to the top menu, choose Add Study, start typing in this study name until you see it appear in the list, click on the study name, click OK.

Important Disclaimer: The information provided on this page is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security. Please see our Risk Disclosure and Performance Disclaimer Statement.

### Calculation

//input = price, user defined, default is midpoint
//period = p1 = user defined, default is 20
//exp = function, returns Euler’s number (e) raised to power of its argument
//log = function, returns natural logarithm of its argument
//index = current bar number, prev = previous

```prevF = ifNull(price, filt[index-1]);  //feedback ingredent
hh = highest(index, p1, HIGH);
ll = lowest(index, p1, LOW);
n3 = (hh - ll) / p1;
halfP = p1/2;
hh = highest(index, halfP, HIGH);
ll = lowest(index, halfP, LOW);
n1 = (hh - ll) / halfP;
hh = highest(index-halfP, halfP, HIGH);
ll = lowest(index-halfP, halfP, LOW);
n2 = (hh - ll) / halfP;
if (n1 moreThan 0 AND n2 moreThan 0 AND n3 moreThan 0) dm = (Math.log(n1+n2) - Math.log(n3)) / Math.log(2);
alpha = Math.exp(-4.6 * (dm - 1));
if (alpha lessThan .01) alpha = .01;
if (alpha moreThan 1) alpha = 1;
Plot: filt = alpha * price + (1 - alpha) * prevF;```