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

Re: Reason # 9,457,298,284.2 as to why I want to strangle the guy who came up with PREV



PureBytes Links

Trading Reference Links

Henry,
You are absolutely correct. In the real world, 2+1-1=2. MetaStock doesn't
exist in the real world.
Some time ago, several of us were trying to find a simple solution to
CCI-Standard,
http://www.stockcentral.com.au/forum/machine/Forum32/HTML/000214.html
where I stumbled across the solution to sum something while holding one of
the variables constant:

V1:=Input("Periods",2,250,14);
x:=Typical();
y:=Mov(x,V1,S);
z:=Sum(Abs(x-LastValue(y+PREV-PREV)),V1)/V1;
A1:=z*0.015;
ZZI:=(x-y)/(If(A1=0,.0000001,A1));
0;
ZZI

In the above example, Abs(x- is summed while the value y is held constant
during each summation for each bar. It is a little trick that I have
remembered for similar problems. In some of the other posts at StockCentral
it was shown that LastValue with +PREV-PREV is useful for holding a variable
as a constant in some equations.
For instance:

A1:=(C-Ref(C,-V1))/-V1;
Mov(C,A1,S)

Doesn't work because A1 isn't held constant for all bars in a plot. Although
it should, it doesn't. It would make the creation of adaptable moving
averages much simpler. But:

A1:=(C-Ref(C,-V1))/-V1;
Mov(C,LastValue(A1+PREV-PREV),S)

Will work. The output isn't meaningful, it's just an example.
I can churn out hundreds of lines of code a day in other computer languages,
but I am always struggling with amazingly simple things with MetaStock
because of the illogical structure and limitations.


-Corey Saxe


----- Original Message -----
From: "Henry Amand" <h.amand@xxxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Tuesday, January 08, 2002 4:48 AM
Subject: Re: Reason # 9,457,298,284.2 as to why I want to strangle the guy
who came up with PREV


> > > A2:=Sum(C + LastValue(A1+PREV-PREV),V1);
> > > A2
> > >
> > > {Maybe PREV is supposed to stand for PREVERT}
> >
> > Since I've got no idea why "LastValue(A1+PREV-PREV)" does what it does
>
>
> Logicaly thinking, it does nothing.
>
> Lets asume A1 = 2 and PREV = 1
>
> That would be 2+1-1 = 2
>
> also, like i see it (but i am not a mathematics expert :-) it does
nothing.
>
>
> > I
> > naturally have no idea why case 2 returns N/A either. Just for a lark I
> > added "A3:=CLOSE" after A1, and substituted "A3" for "C". Try it - I'll
> bet
> > it's not what you were looking for but at least it isn't N/A.
> >
> > Roy
> >
> >
>
>