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

Re: Reverse Engineering Request (VIDYA)



PureBytes Links

Trading Reference Links


As you may have noticed, there's a bit of extra code in my VIDYA user
function, below.  The "NumUp" and "NumDn" variables aren't needed in VIDYA,
there only used in VIDYA2 (my version of VIDYA).  These extra variables
won't hurt anything in the VIDYA code, but they are unnecessary.  Here's how
the code for the VIDYA User Function should have looked:



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);




All the best,

The Omega Man (TM)


Omega - Love it or Leave it.



-----Original Message-----
From: The Omega Man (TM) <editorial@xxxxxxxxxxxxx>
To: William Heinz <wheinz@xxxxxxx>
Cc: Omega List <omega-list@xxxxxxxxxx>
Date: Thursday, September 17, 1998 5:41 AM
Subject: Re: Reverse Engineering Request (VIDYA)



Bill Heinz requested some Easy Language code for Dr. Tuschar Chande's
"VIDYA" indicator.  The indicator is described in Chapter 3 of Dr. Chande's
book "The New Technical Trader".  Basically, VIDYA is an adaptive
exponential moving average.  The adaptation speed is determined by market
momentum, as measured by "AbsCMO", the absolute value of the Chande Momentum
Oscillator.



First, create a user function called VIDYA, as follows:


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

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

SumUp = 0;
SumDn = 0;
NumUp=0;
NumDn=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:


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;



Note:  The "speed" input is a little addition I made.  Something to
experiment with.  Try using values between 1 and 2.  For the "pure"
indicator, as described in Dr. Chande's book, set the speed set to 1.



Here's a variation I developed based on Dr. Chande's theme:

Create a user function called VIDYA2, as follows:


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

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

SumUp = 0;
SumDn = 0;
NumUp=0;
NumDn=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;
If Diff > 0 then NumUp=NumUp+1 else NumDn=NumDn+1;
End;

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

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




Now create the indicator (VIDYA2) as follows:



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

Var:  PlotVal(0);

PlotVal = VIDYA2(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;




Try varying the speed input in VIDYA2 from 1 to 4.  Set it to suit your
trading style.  I prefer my VIDYA2 to the original VIDYA.  It suits my style
better.  But I'll let you be the judge...

One final note:  These indicators could be coded as indicators only -
without the use of user functions.  I've provided the user functions in case
you wish to incorporate VIDYA or VIDYA2 into a trading system.



All the best,

The Omega Man (TM)


Omega - Love it or Leave it.




-----Original Message-----
From: William Heinz <wheinz@xxxxxxx>
To: editorial@xxxxxxxxxxxxx <editorial@xxxxxxxxxxxxx>
Date: Monday, September 07, 1998 7:00 PM
Subject: Re: Reverse Engineering Request


I forgot to mention he indiator  I am interested in. Chapter 3 "The Variable
Index Dynamic Index" (VIDYA)
Thanks again, Bill
-----Original Message-----
From: William Heinz <wheinz@xxxxxxx>
To: The Omega Man (TM) <editorial@xxxxxxxxxxxxx>
Date: Monday, September 07, 1998 6:21 PM
Subject: Re: Reverse Engineering Request


>Omega Man,    The Book is "The New Technical Trader" by  Tuschar S Chande
>and Stanley Kroll (John
> Wiley & Sons) @ $64.95. Be happy to copy the chapter and mail it to you.
>There are some other interesting topics as well.
>
>Many thanks
>
>Bill
>
>PS You seem quite talented in your reverse engineering. This should be very
>easy as the formulas, etc to calculate the indicator are described.
>