Try using Low for calculating BBand

x = BBand(L,20,2)

if L < x   then you have your trade

----- Original Message ----- 
From: "mbausys" <[email protected]>
To: <[email protected]>
Sent: Thursday, April 15, 2010 9:32 AM
Subject: [amibroker] Re: Change last value of array


> To make it clearer, I'll give another example:
>
> I make intraday trades and want to backtest a strategy that enters a trade 
> if price falls below lower Bollinger band intraday. I have a price history 
> of a random stock and see that 10 days ago its
> C = 100
> L = 94
> BBandBot( C, 20, 2 ) = 95
>
> Would I have entered the trade on that day? L < BBandBot, but it is not 
> clear if the band hadn't shifted below 94 when the price was at 94. In 
> order to answer the question, I need to find out at what level price 
> would've been equal to BBandBot and if L was below that determined level, 
> the trade would've happened. I hope this example makes the matter clearer.
>
>
> --- In [email protected], "mbausys" <mbau...@...> wrote:
>>
>> Guys, I want to backtest this system rather than have a value for today. 
>> And I'm absolutely sure that the concept & logic are right.
>>
>>
>> --- In [email protected], "Rob" <sidhartha70@> wrote:
>> >
>> > I think Ara's right... I think your concept & logic are fundamentally 
>> > flawed. Which is why it won't work.
>> >
>> > --- In [email protected], "Ara Kaloustian" <ara1@> wrote:
>> > >
>> > > When you get the value of BBand, it is a dynamic value ...
>> > >
>> > > so in your example of C = 100 and BBand = 95,
>> > > the buy order would of course be somewhere below 95. The point would 
>> > > be
>> > > determined correctly by either:
>> > >
>> > > L < BBand or Cross(BBand,L);
>> > >
>> > > If you are cornerned about the buy price being far below 95 (in the
>> > > example), then perhaps you should use a different strategy, as BBands 
>> > > will
>> > > shift with price moves
>> > >
>> > >
>> > > ----- Original Message ----- 
>> > > From: "mbausys" <mbausys@>
>> > > To: <[email protected]>
>> > > Sent: Thursday, April 15, 2010 8:49 AM
>> > > Subject: [amibroker] Re: Change last value of array
>> > >
>> > >
>> > > > I'll give you a brief example:
>> > > >
>> > > > We are in the middle of trading session;
>> > > > Current C = 100
>> > > > Current BBandBot( C, 20, 2 ) = 95
>> > > > I want to set a limit order that buys if price falls bellow lower
>> > > > Bollinger band. However, a limit order at 94.99 would be incorrect 
>> > > > way of
>> > > > doing that because when the price reaches 94, the actual lower 
>> > > > Bollinger
>> > > > band would have shifted far below 94.99. Thus, I need to a dynamic
>> > > > calculation of lower Bollinger band that determines the true level.
>> > > >
>> > > > --- In [email protected], "Ara Kaloustian" <ara1@> wrote:
>> > > >>
>> > > >> Dont really understand your comments ... as Low and Close 
>> > > >> frequently are
>> > > >> below lower BB...
>> > > >>
>> > > >> Try using L <= BBandBot(...)
>> > > >>
>> > > >>
>> > > >> ----- Original Message ----- 
>> > > >> From: "mbausys" <mbausys@>
>> > > >> To: <[email protected]>
>> > > >> Sent: Thursday, April 15, 2010 8:16 AM
>> > > >> Subject: [amibroker] Re: Change last value of array
>> > > >>
>> > > >>
>> > > >> > 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" <sidhartha70@> 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
>> > > >> >> > > > >
>> > > >> >> > > >
>> > > >> >> > >
>> > > >> >> >
>> > > >> >>
>> > > >> >
>> > > >> >
>> > > >> >
>> > > >> >
>> > > >> > ------------------------------------
>> > > >> >
>> > > >> > **** IMPORTANT PLEASE READ ****
>> > > >> > This group is for the discussion between users only.
>> > > >> > This is *NOT* technical support channel.
>> > > >> >
>> > > >> > TO GET TECHNICAL SUPPORT send an e-mail directly to
>> > > >> > SUPPORT {at} amibroker.com
>> > > >> >
>> > > >> > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>> > > >> > http://www.amibroker.com/feedback/
>> > > >> > (submissions sent via other channels won't be considered)
>> > > >> >
>> > > >> > For NEW RELEASE ANNOUNCEMENTS and other news always check 
>> > > >> > DEVLOG:
>> > > >> > http://www.amibroker.com/devlog/
>> > > >> >
>> > > >> > Yahoo! Groups Links
>> > > >> >
>> > > >> >
>> > > >> >
>> > > >> >
>> > > >>
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > ------------------------------------
>> > > >
>> > > > **** IMPORTANT PLEASE READ ****
>> > > > This group is for the discussion between users only.
>> > > > This is *NOT* technical support channel.
>> > > >
>> > > > TO GET TECHNICAL SUPPORT send an e-mail directly to
>> > > > SUPPORT {at} amibroker.com
>> > > >
>> > > > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
>> > > > http://www.amibroker.com/feedback/
>> > > > (submissions sent via other channels won't be considered)
>> > > >
>> > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> > > > http://www.amibroker.com/devlog/
>> > > >
>> > > > Yahoo! Groups Links
>> > > >
>> > > >
>> > > >
>> > >
>> >
>>
>
>
>
>
> ------------------------------------
>
> **** IMPORTANT PLEASE READ ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
>
> TO GET TECHNICAL SUPPORT send an e-mail directly to
> SUPPORT {at} amibroker.com
>
> TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> http://www.amibroker.com/feedback/
> (submissions sent via other channels won't be considered)
>
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> Yahoo! Groups Links
>
>
>

Reply via email to