[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] How to access the first 2 bars of a day?



PureBytes Links

Trading Reference Links

This should work

xx =  Datenum() !=Ref(Datenum(),-1);
bar1H = ValueWhen(XX,H,1); //high of first bar of day
bar2H = ValueWhen(ref(XX,-1),H,1); //high of second bar of day
bar1L = ValueWhen(XX,L,1); //low of first bar of day
bar2L = ValueWhen(ref(XX,-1),L,1);
//low of second bar of day

or if you wanted the highest and lowest of the first 2 bars of the day
bar2H = ValueWhen(ref(XX,-1),HHV(h,2)); //high of second bar of day
bar2L = ValueWhen(ref(XX,-1),LLV(L,2)); //low of second bar of day


make sure your analyser period setting matches oyur charts to get same results

--
Cheers
Graham
AB-Write >< Professional AFL Writing Service
Yes, I write AFL code to your requirements
http://e-wire.net.au/~eb_kavan/ab_write.htm



On 30/05/06, Clement, Gmail < manyit99@xxxxxxxxx> wrote:

Hi, Rick,

 

Thanks for your code. I paste the codes into AB. I check the returned values but they are incorrect. I am new to AB and I don't know how your codes work.

 

Clement

 

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Rick Osborn
Sent: Tuesday, May 30, 2006 11:07 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] How to access the first 2 bars of a day?

 

Try

bi = BarIndex()+1;
xx =  ValueWhen(Day() !=Ref(Day(),-1),bi);
bar1H = ValueWhen(bi ==XX+1,H,1);
bar2L = ValueWhen(bi ==XX+1,L,1);
bar2H = ValueWhen(bi ==XX+2,H,1);
bar2L = ValueWhen(bi ==XX+2,L,1);

Rick

--- "Clement, Gmail" <manyit99@xxxxxxxxx> wrote:

> I am using 15-minute chart and the first bar started
> at 8:00am. Please tell
> me a way to get the high and low of the first 2 bars
> of current day.
>

>
> Thank you.
>

>
> Clement
>

>
>


Rick Osborn & Associates
885 Sorrento Ave.
Oshawa, Ontario L1J 6V6
(905) 728-8543  fax 728-0815




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS








Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS