You said you only wanted to do it for the last day (or last value in the array)...?
LastValue() will only access the last value in the array hence will only work for the last day... What exactly are you trying to do...? explain in detail and we might be able to help... --- In [email protected], "mbausys" <mbau...@...> wrote: > > I have this very short code, which is supposed to determine at what price > level every day the price would have been equal to lower Bollinger Band. > However, the code seems to do the trick only for the last day. Any hints > where I may be wrong? > > P = C; // P is a target price level > diff = P / 2; > > for( i = 0; i < 100; i++ ) > { > P = IIf( P < BBandBot( C, 20, 2 ), C + diff, C - diff ); > C[ LastValue( BarIndex() ) ] = P[ LastValue( BarIndex() ) ]; > diff = diff / 2; > } > > --- In [email protected], "jooleanlogic" <jooleanl@> wrote: > > > > I think that will only work in version 5.3 Sid. > > > > BarIndex() changed from being the actual index in 5.2, to always starting > > at 0 in 5.3. > > So LastValue(BarIndex()) in 5.2 can give you a number greater than BarCount > > under QuickAFL. > > > > You could just use BB_Array[BarCount-1] which will always work. > > > > Jules. > > > > > > --- In [email protected], "Rob" <sidhartha70@> wrote: > > > > > > Sure... if BBand is the array you want to change, > > > > > > Last_Val_BI = LastValue( BarIndex()); > > > BB_Array [Last_Val_BI] = New value here... > > > > > > try something like that. > > > > > > --- In [email protected], "mbausys" <mbausys@> wrote: > > > > > > > > Hi all, > > > > > > > > Is there a simple way of changing the last value of an array? > > > > I want to find Bollinger Band of, e.g. 10 days of closing prices, but > > > > would like to use a different value for day 10 rather than the real > > > > closing price for that day. > > > > > > > > Any help would be appreciated. > > > > > > > > Many thanks, > > > > > > > > Marius > > > > > > > > > >
