Inputs: Period(10);
Vars: Signal(0), Noise(0), Diff(0), ER(0), Smooth(1), Fastest(.6667), Slowest(.0645), AMA(0);
Diff = AbsValue(Close — Close[1]);
IF CurrentBar <= Period Then AMA = Close;
IF CurrentBar > Period Then Begin
Signal = AbsValue(Close — Close[Period]);
Noise = Summation(Diff, Period);
If Noise > 0 then ER = Signal / Noise;
Smooth = Power(ER ∗ (Fastest — Slowest) + Slowest, 2);
AMA = AMA[1] + Smooth ∗ (Close — AMA[1]);
End;
Plot1( AMA, «AMA»);