In essence, I want to backtest a trading system that uses lower Bollinger Band 
as an entry point and would enter trades intraday when price touches the lower 
band. However, I can't use L < BBandBot( C, 20, 2 ) as at the point when price 
is at its L, BBand would be lower than BBandBot( C, 20, 2 ) and the trade might 
be not triggered in reality. Therefore, I want to find price levels at which P 
would be equal or just fall below lower BBand. That level would be my BuyPrice 
as well.

Thanks,

Marius


--- In [email protected], "Rob" <sidharth...@...> wrote:
>
> 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" <mbausys@> 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
> > > > >
> > > >
> > >
> >
>


Reply via email to