"Louis P."
> > <rockprog80@>
wrote:
> > >
> > > Hi,
> > >
>
> > Here is what I tried to do:
> > >
> > >
barhh1 = HHVBars( High, Periods ) ;
> > > bi1 = BarIndex()
;
> > > y11 = LinearReg( C, barhh1 ) ;
> > > y01 =
LinRegIntercept( H, barhh1 ) ;
> > > sl1 = LineArray(
bi1-barhh1+0, y01, bi1, y11, 0, True );
> > >
> > >
Unfortunately it seems there is an error...
> > >
> >
> What's the barindex for in that code, and if the problem is
there,
> > how can I
> > > deal with it, considering
that for the first 4 lines of that code it
> > began
> >
> with "selectedvalue"?
> > >
> > >
Thanks,
> > >
> > > Louis
> > >
>
> >
> > >
> > > 2008/9/12 Barry Scarborough
<razzbarry@>
> > >
> > > > Ara said just
use the variable. For instance C is an array and
using
> > >
> C will point to the last value, or the current bar, in the
array.
To
> > > > point to a bar prior to the current one use Ref(C,
-n); where n is
> > > > the number of bars prior to the
current one. Replace C with
the array
> > > > you want to
get the value for.
> > > >
> > > > Use
LastValue when you need a value and not an array. An
example is
>
> > > in an IF statement. IF() cannot take an array and you have
to
get the
> > > > value. If you want the value of some
previous value use
LastValue(ref
> > > > (c,-n));
>
> > >
> > > > If your results get confusing dump it
to the interpretation
window so
> > > > you can compare
the values with what you expect them to be. Use
> > > >
something like this:
> > > >
> > > >
printf(numtostr(lastvalue(c), 1.2)); // current value of c
> > >
> printf("\n" + numtostr(lastvalue(ref(c, -1)), 1.2)); // previous
c
> > > >
> > > > Barry
> > >
>
> > > >
> > > > --- In
amibroker@xxxxxxxxxxxxxxx