[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changing output from AMA



PureBytes Links

Trading Reference Links

Hi Adam and other formula writers

How would I rewrite this AMA formula to output the number of days that the
AMA is using rather than the AMA value for the tradeable?

I want to use it in the following Stochastic formula to define the number of
days in Range:

(Current Value - Low of Range)/(High of Range-Low of Range)

Thanks for your help

Best regards

Walter

===========================

Periods := Input("Time Periods",1,1000, 10);

Direction := CLOSE - Ref(CLOSE,-periods);

Volatility := Sum(Abs(ROC(CLOSE,1,$)),periods);

ER := Abs(Direction/Volatility);

FastSC := 2/(2 + 1);

SlowSC := 2/(30 + 1);

SSC := ER * (FastSC - SlowSC) + SlowSC;

Constant := Pwr(SSC,2);

AMA := If(Cum(1) = periods +1, Ref(CLOSE,-1) + constant * (CLOSE -
Ref(CLOSE,-1)),PREV + constant * (CLOSE - PREV));

AMA