AMA2
|
Moving averages, summation |
| SYNTAX | ama2( ARRAY, SMOOTHINGFACTOR, FEEDBACKFACTOR ) |
| RETURNS | ARRAY |
| FUNCTION |
calculates adaptive moving average - simliar to EMA() but smoothing factor
could be time-variant (array). AMA2 has a separate control of feedbackfactor which is normally (1-SMOOTHINGGFACTOR). Internally this function works like this: today_ama = SMOOTHINGFACTOR * array + FEEDBACKFACTOR * yesterday_ama |
| 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 = ama2( close, sc, 1-sc); |
| SEE ALSO |
The AMA2 function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.