VIDYA

VIDYA

Type : Function, Name : VIDYA

Input: Price(numericseries), CMOLen(numeric), VIDYALen(numeric),
Speed(numeric);

Var: Cnt(0),SumUp(0), SumDn(0), Diff(0),VIDYAPri(0),AbsCMO(0),Const(0);

SumUp = 0;
SumDn = 0;

For Cnt = 0 to CMOLen-1 Begin
Diff = Price[Cnt] — Price[Cnt+1];
If Diff > 0 then SumUp = SumUp + Diff else SumDn=SumDn-Diff;
End;

AbsCMO = Speed*AbsValue((SumUp-SumDn)/(SumUp+SumDn));
Const = 2/(VIDYALen+1);

VIDYA = iff(Barnumber>VIDYALen,(Price*Const*AbsCMO) +
((1-AbsCMO*Const)*VIDYA[1]),Price);

 

Now create the indicator, using the following code:
Type : Indicator, Name : VIDYA

Input: Price(TypicalPrice), CMOLen(9), VIDYALen(12), UBandPct(1),
LBandPct(1),Speed(1);

Var: PlotVal(0);

PlotVal = VIDYA(Price,CMOLen,VIDYALen, Speed);

If PlotVal > 0 then begin
Plot1(PlotVal,»VIDYA»);
Plot2((1 + UBandPct*.01)*PlotVal,»Upper Band»);
Plot3((1 — LBandPct*.01)*PlotVal,»Lower Band»);
End;

Николай Солабуто
Оцените автора
Николай Солабуто
Добавить комментарий