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

Fw: More PREV Stuff @@



PureBytes Links

Trading Reference Links



> Here is the reply from tech support on the PREV function.
>
> Hope it helps.
> Lionel Issen
> lissen@xxxxxxxxx
> ----- Original Message -----
> From: <formulas@xxxxxxxxx>
> To: <lissen@xxxxxxxxx>
> Sent: Tuesday, March 27, 2001 4:30 PM
> Subject: RE: More PREV Stuff [FOR2001032600000111]
>
>
> > To enable us to provide more efficient support, use the "Reply" feature
in
> your email program when responding to this email.  Please send unrelated
> issues in a new email.
> >
> > Your email was responded to by:
> > William
> > Equis Customer Support
> > http://www.equis.com
> >
> >
> > William's response is below the following line.
> > -----------------------------------------------------------------------
> >
> >
> > The +PREV-PREV logic is a way of forcing MetaStock to dynamically
> > calculate some value that is normally static.  The formula is suppose to
> > sum the differences between the current value of pr and a series of
> > previous values.  I could have manually written each days value, but it
> > would have been ugly to type and would have locked in a set time frame.
> >
> > The alterative was to nest the part of the equation that needed to
> > change into the logic of:
> >
> > LastValue( data array +PREV-PREV )
> >
> > The LastValue() function forces MetaStock to see it as a constant value
> > equal to its last calculated value in the chart.  This effect also
> > allows the second part to work.
> >
> > The PREV function forces MetaStock to recalculate the formula to find
> > the formula's value for the previous bar.  To illustrate, consider the
> > following formula:
> >
> > ( H-L ) - PREV
> >
> > Because of the PREV function refers to the previous bar of data, this
> > formula has no value for the first record loaded ( there is no previous
> > bar to refer to ).
> >
> > On the second bar, since the formula could not be calculated on the
> > first bar, PREV has the value of 0 so the formula is calculated as the
> > High minus the Low.  For this example, assume the result is 5.
> >
> > On the third bar of data, the High minus the Low is calculated again.
> > This time the result is 4.  Now the value of the formula for the
> > previous bar is recalculated to get the result 5 and that number is
> > subtracted from 4.  The result of the formula for this bar is -1.
> >
> > On the fourth bar, the High minus the Low yields a result of 3.  Now we
> > subtract the previous value of the formula, -1, to get the final result
> > of 4; ( 3 - (-1) ).
> >
> > The fact that PREV forces the recalculation negates the LastValue()
> > function's only looking at the last bar.  LastValue() returns the last
> > calculated value, but PREV keeps changing which value is the last one
> > calculated.  Since the formula does not include the previous value in
> > its calculation, we can negate the PREV function by subtracting it and
> > adding it at the same time.
> >
> > Looking back at the formula you asked about:
> >
> > coef:=Sum(Power(Ref(LastValue(pr+PREV-PREV)-pr,-1),2),ti);
> >
> > The formula is suppose to take a certain time frame, say 5 days.  Over
> > those 5 days, it totals the square of the value of pr from 5 days ago
> > minus it value today; plus the square of the value of pr from 4 days ago
> > minus it value today; plus the square of the value of pr from 3 days ago
> > minus it value today; plus the square of the value of pr from 2 days ago
> > minus it value today; plus the square of the value of pr from 1 day ago
> > minus it value today.  By using the LastValue() +PREV-PREV trick, each
> > of the previous values of pr is dynamically calculated for however many
> > periods are being used.
> >
> > I know this concept can be confusing and I hope I explained it well.  If
> > any part is confusing, please respond and I will try and answer any
> > questions you may still have
> >
> >
> >
> > -----Original Message-----
> >
> > This was posted to the listserver.
> >
> > Can you clarify the problem and give the correct usage of the PREV
> > function?
> >
> > Lionel Issen
> > lissen@xxxxxxxxx
> > ----- Original Message -----
> > From: "C.S." <csaxe@xxxxxxxxxxx>
> > To: <metastock@xxxxxxxxxxxxx>
> > Sent: Friday, March 23, 2001 4: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
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > "MetaStock, Equis, OptionScope, and QuoteCenter are registered
trademarks
> of Equis International.  Achelis Binary Wave, The DownLoader, Expert
> Advisor, The Explorer, Visual Control, and Smart Charts are trademarks of
> Equis International."
> >
> >
>