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

Re: The New Technical Trader (VIDYA)



PureBytes Links

Trading Reference Links

(1)  The version of  "Vidya using the P variable" contains an error.
The Vidya line should read:
Vidya:= A*K*P + (1-A*K)*PREV;
The error probably stems from an error in Chande & Kroll's "New
Technical Trader" p.52, formula 3.2 in which the last term shows
yesterday's close when it should show yesterday's value of Vidya.

(2)  Here is a version that matches the MStk built-inVariable Moving
Average.  You can overlay them in different colours on the same chart to
satisfy yourself that they are indeed the same (use the same number of
periods).  There is a small difference at the start due to different
initialisation, after which they are identical.  The coding is spelled
out for the benefit of anyone studying the book.  It can be adapted by
adding a variable input for the CMO length (9), or made universal by
replacing each C with a P, or the Abs(CMOsc) can be replaced with a
different volatility index that ranges between 0 and 1..

{Vidya (Chande)}

Pds:= Input("Number of Periods?",1,1000,20);
Alpha:= 2/(Pds+1);

{Chande Momentum Oscillator}
{UD = Up day}
{DD = Down day}
UD:= Sum((C-Ref(C,-1))*(C>Ref(C,-1)),9);
DD:= Sum((Ref(C,-1)-C)*(C<Ref(C,-1)),9);
CMOsc:= (UD-DD)/(UD+DD);

k:= Abs(CMOsc);

Vidya:= (Cum(1) < Pds) * C + (Cum(1)>=Pds) * ((Alpha * k * C) + (1-Alpha
* k) * PREV);
Vidya

(3)  In my previous post on this thread I said there was an error in the
MStk manual's explanation of the VMA, and there is, but I had it
reversed.  The 0.78 should read 0.078, which roughly corresponds to a 24
period MA: (2/(24+1) = 0.08).

HHP
==========================

Barry Marx wrote:

> Just found another version of Vidya further down on the same page:My
> version of Tushar Chande's Vidya using the P variable
>
> Vidya{P}
> Periods:=Input("length of MA",5,100,20);
> K:=Stdev(P,5)/Mov(Stdev(P,5),20,S);
> A:=(2/(Periods+1));
> Vidya:=A*K*(P)+(1-A*K)*Ref(P,-1);
> Vidya;

[SNIP]