AMA
- adaptive moving average

Moving averages, summation
(AmiBroker 3.50)


SYNTAX ama( ARRAY, SMOOTHINGFACTOR )
RETURNS ARRAY
FUNCTION calculates adaptive moving average - simliar to EMA() but smoothing factor could be time-variant (array).
EXAMPLE The example of volatility-weighted adaptive moving average formula: graph0 = ema( close, 15 );
fast = 2/(2+1);
slow = 2/(30+1);
dir=abs(close-ref(close,-10));
vol=sum(abs(close-ref(close,-1)),10);
ER=dir/vol;
sc =( ER*(fast-slow)+slow)^2; graph0 = ama( close, sc );
SEE ALSO

Comments:

Tomasz Janeczko

2006-04-26 20:13:15
output = AMA( input, factor )

is equivalent to the following looping code:

for( i = 1; i < BarCount; i++ )
{
output[ i ] = factor[ i ] * input[ i ] + ( 1 - factor[ i ] ) * output[ i - 1 ];
}

References:

The AMA function is used in the following formulas in AFL on-line library:

More information:

See updated/extended version on-line.