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

Re: More PREV Stuff



PureBytes Links

Trading Reference Links

Three items to consider:

First of all, for the MetaStock programming language, plus and minus are not
on the same precedent level. Within the same expression or parenthesis, the
minus calculation would take precedence. See your manual, page 222-223,
version 7.0 EOD. In conventional mathematics, they would be on the same
level. But MS is not conventional :).

Second of all, PREV is analogous to a recursive procedure wherein the
mathematical calculation repeats itself, albeit not indefinitely.

Third, each PREV expression in a formula is an independent expression
standing on it's own and has nothing to do with any of the PREV's that
precede it. For each PREV expression, it uses the variables immediately
preceding it to calculate the previous days values for these variables and
executes the operator preceding PREV. AS the manual states, the expression
((H+L+C)/3 + PREV) takes today's values of H,L & C, adds them together and
divides the sum by 3. Then it computes the same for the previous day and
adds it to the answer for today's values. To continue on, let's call the
answer to the above calculation, ANSWER#1. Then if we had an expression
which was ((H+L+C)/3 + PREV)*PREV we could rewrite it as (ANSWER#1)*PREV.
This expression would compute ANSWER#1 and then multiply it by yesterday's
value of ANSWER#1.

I hope this makes sense (And I believe it to be correct, but I would not bet
my first born until it is tested and corroborated by others.)

Jim Barone

----- Original Message -----
From: C.S. <csaxe@xxxxxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Friday, March 23, 2001 5:49 PM
Subject: Re: More PREV Stuff


> Yes, I realize that, but addition and subtraction is on the same
precedence
> level. However I assume that (pr+PREV-PREV) should be the same as (pr),
> because
> Ref(LastValue(pr+PREV-PREV)-pr,-1) = Ref(LastValue(pr-PREV+PREV)-pr,-1).
>
>
> In examining the equation, I found another interesting phenomena,
>
> pr:=CLOSE;
> Ref(LastValue(pr+PREV-PREV)-pr,-1)
>
> Is not the same as:
>
> Ref(LastValue(CLOSE+PREV-PREV)-CLOSE,-1)
>
> Even though
>
> Ref(LastValue(C)-C,-1) = Ref(LastValue(pr)-pr,-1)
> and
> LastValue(pr+PREV-PREV)-pr = LastValue(C+PREV-PREV)-C
>
> .....the "plot" thickens....
> -Corey
>
>
>
> ----- Original Message -----
> From: <wooglin.org@xxxxxxxxxxx>
> To: <metastock@xxxxxxxxxxxxx>
> Sent: Friday, March 23, 2001 10:49 AM
> Subject: Re: More PREV Stuff
>
>
> > I suspect the answer lies in the "Operator Precedence" in conjunction
with
> > the PREV function. If Operator Precedence is not involved, you must
> > recognize that the PREV constant cannot be treated in a conventional
> > algebraic context like any other constant or variable. That is, you
cannot
> > multiply or divide through an expression to eliminate a PREV. For
instance
> > (PREV(C+PREV) is not the same as C*PREV + PREV^2 or (Pr+PREV-PREV) is
not
> > the same as Pr.
> >
> > Jim Barone
> >
> > ----- Original Message -----
> > From: C.S. <csaxe@xxxxxxxxxxx>
> > To: MetaStock List <metastock@xxxxxxxxxxxxx>
> > Sent: Friday, March 23, 2001 1:11 PM
> > Subject: More PREV Stuff
> >
> >
> > > Just when I thought that I was beginning to figure out Metastock
formula
> > > language, the following was listed in Apr 01 TASC Traders' Tips as the
> > > solution to Ehler's nonlinear filter article. The first one is easy to
> > > figure out from the article.
> > >
> > > {Ehlers Filters}
> > > ti:=15;
> > > pr:=MP();
> > > coef:=Abs(pr-Ref(pr,-5));
> > > Sum(coef*pr,ti)/Sum(coef,ti)
> > >
> > >
> > > This one works, but has me stumped as to how it works according to the
> > > article. You really have to read the article to understand what is
being
> > > calculated here.
> > >
> > > {Distant Coefficient Ehlers Filter}
> > > ti:=15;
> > > pr:=MP();
> > > coef:=Sum(Power(Ref(LastValue(pr+PREV-PREV)-pr,-1),2),ti);
> > > Sum(coef*pr,ti)/Sum(coef,ti)
> > >
> > > The two PREV would appear to be just adding a number and then
> subtracting
> > a
> > > number, leaving "pr" but that isn't the case. The formulas were
written
> by
> > > Cheryl Abram of Equis. It would be nice if someone at Equis would
> consider
> > > having her give a us a quick class on how this works and other formula
> > > construction tips.
> > >
> > > I came up with:
> > >
> > > ti:=15;
> > > pr:=MP();
> > > coef:=Sum(Power(LastValue(pr)-Ref(pr,-1),2),ti);
> > > Sum(coef*pr,ti)/Sum(coef,ti)
> > >
> > > This works too, but doesn't follow rapid price changes as quickly as
> > > Cheryl's formula.
> > >
> > > Any ideas on how the two PREV act together?
> > >
> > > -Corey
> > >
> > >
> > >
> > >
> >
> >
>