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

Re: Question



PureBytes Links

Trading Reference Links

Hmmmmm...... Some further testing this morning shows that the 'PREV' and
the 'ref' functions did not always return the same binary values.  (My first
test
had only been run on about 50 issues, further testing was over about 750
issues.)

Also, I've noticed that the statement 'C + PREV' seems to return a sum of
all
close values whereas the statement 'C + ref(C,-1)' just returns the sum of
the
current bar's Close and yesterday's Close.

These functions are obviously not acting the same, but what is the
difference?

Curious & curiouser ............... John
----- Original Message -----

> There have been some posts lately using either the 'ref' or the 'PREV'
> functions.  My question is: are the 2 functions mathematically equivalent?
> And, would there ever be a reason that you would be forced to use 'PREV'
> over 'ref '?  The following is an example I created (not very
sophisticated)
> that created a binary output based upon whether today's close was greater
> than yesterdays close which seems to show that the two are equivalent.
>
> Statement A:   x:= If(C > PREV, 1, 0);
> Statement B:   x:= If(C > ref(C,-1), 1, 0);
>
> Thoughts? ........ John
>
>