PureBytes Links
Trading Reference Links
|
Thanks to everyone who suggested I use a second variable to store the
average value in like this:
diff=c-c[1];
diff1=average(diff,3);
plot1(diff1,"diff");
Someone said the problem happens because "diff" has already been used. I
was trying to be thrifty (:-). However, I thought you were allowed to
change the value of a variable by referencing itself such as:
count=count+1;
So I assumed my version would work. Is there some obtuse aspect of EL at
work here?
Ian
> I'm having trouble with Average. Probably just not got my head around
> something but would appreciate a pointer...
>
> I'm calculating the difference between this bar's close and the
> previous bar's close and trying to plot the 3-bar average but I get
> different results depending on when the Average is taken. For example:
>
> diff=c-c[1];
> plot1(average(diff,3),"diff");
>
> produces a different plot to:
>
> diff=c-c[1];
> diff=average(diff,3);
> plot1(diff,"diff");
>
> I would have assumed they'd plot the same plot. Where am I going
> wrong?
>
> Ian
>
>
|