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

EL functions of Data1, Data2



PureBytes Links

Trading Reference Links

At 01:15 PM 10-07-98 +0100, you wrote:
>Can someone tell me what is the matter with this ShowMe?
>
>input:	P2 (c data2), Length(20);
>
>print("Average:  ", Average(P2, Length), Average(c data2, Length));
>print("StdDev:  ", StdDev(P2, Length), StdDev(c data2, Length));
>
>if 1=2 then plot1(0, "plot");
>
>The two averages differ and the two stddev's also differ.  Why?
>

It sure looks like it should work, doesn't it!

This might be slightly off the subject at hand, but I have a note written to myself as a comment in code written long ago to *always* use

Average(C, Length) of data2, 

instead of

Average(C of data2, Length)

because of a very nasty and difficult to track down bug where certain functions are delayed by one bar.

Try comparing a printlog window of the values of your two different expressions - do you find one to be the same as the other but delayed by one bar? The delayed one would be the one in error.

If so, perhaps if you replace your Average(c data2, Length) with Average(c, Length) of Data2 they'll come out the same, and correct.

You might also try simply using plain old "C" as your default input variable instead of "C of data2", and then basing the study itself on Data2. This might fix you up, as long as you aren't using data1 variables as well elsewhere in the function.

Let us know if this helps.

Mike Gossland