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

Re: ELA for the Variable Index Dynamic Average



PureBytes Links

Trading Reference Links

> My question is:  Is this enough information and can the VIDYA
> moving average be transformed into Easy Language, and if so, what
> would the code be? 

This is what I have.  I don't recall who originally wrote it.

Gary


{ Function VIDYA }
Inputs: Length(NumericSimple), Smooth(NumericSimple);
Vars: Up(0), Dn(0), UpSum(0), DnSum(0), AbsCMO(0), SC(0);

Up=IFF(Close>Close[1], Close-Close[1],0);
Dn=IFF(Close<Close[1], AbsValue(Close-Close[1]),0);

UpSum=Summation(Up,Length);
DnSum=Summation(Dn,Length);

If UpSum+DnSum >0 then 
AbsCMO=AbsValue((UpSum-DnSum)/(UpSum+DnSum));

SC= 2/(Smooth+1);

If Currentbar=Length then VIDYA=Close;
If Currentbar>Length then 
	VIDYA=(SC*AbsCMO*Close)+((1-(SC*AbsCMO))*VIDYA[1]);