If you have it in 1 minute bar timeperiod then the 3rd bar for the day would be

price13 = valuewhen( datenum()!=ref(datenum(),-3), C );

if you have this in smaller bar periods (eg 30 second periods) you can
put this inside the timeframeset function. This will give you the
price of the 3rd bar for the day

timeframeset(in1minute);
price3 = valuewhen( datenum()!=ref(datenum(),-3), C );
timeframerestore();
price13 = timeframeexpand( price3, in1minute);

if your bar period is greater than 1 minute then you cannot do it

If you specifically want the 3rd minute, and this bar does actually
exist, then you can just use timenum, and

price13 = valuewhen( timenum()==100200, C );
or
price13 = valuewhen( timenum()==100259, C );
the 2 choices depends on if you have the bars set to show as start or
end times of the bars, and also the bar periods are 1 minute, or
smaller factors of 1 minute (eg 30 second intervals will have the
minute bars, but 25 second intervals will not always show exact 1
minute bars.
There are other ways to do this, just needs imagination to work out
how to define exactly what you want

Just hope I understood your query
-- 
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 31/07/06, Ryan Daniel <[EMAIL PROTECTED]> wrote:
> I was wondering if anyone could help me make my programs
> more efficient. I often need to determine the OHLCV values
> of specific 1-minute bars throughout the day, but especially
> the first, second, and third 1-minute bars in the morning (usually
> occurring at 9:30, 9:31, and 9:32 a.m. eastern or NYSE time).
>
> I currently use the following to retrieve the third bar of the day
> where 1060727 would be yesterday's date for example:
>
> TimeFrameSet(in1Minute);
>
> BARS = BarsSince(DateNum()==1060727) - 3;
>
> L1 = LastValue( Ref(Close, -BARS) );
>
> ...PerformSomeActionUsingL1(L1);
>
> TimeFrameRestore();
>
>
> So let's say I am running an AFL program and it is about
> 20 minutes after the opening bell (or 9:50 a.m. Eastern time).
> And I wish my program to retrieve the CLOSE value of
> the third 1-minute bar of the day. The above routine seems
> kind of lengthy to me. Is there a simpler, more concise way
> of doing this?
>
> Or perhaps a simpler way to state this. What is the easiest
> way to retrieve the OHLCV value of any 1-minute bar throughout
> the day.
>
> Here is an example (a fake or fantasy example) of what I believe
> would be a really concise way of doing this, if the command
> existed, using direct referencing instead of relative referencing.
>
> Fake command example:
>
> L1 = DirectClose(Today(ThirdBar));
>
> Or, another example might be...
>
> L1 = CloseValue(Today,093300);
>
> Or, a better example where 3 means the 3rd bar...
>
> L1 = CloseValue(Today,3);
>
> Can I construct anything even close to this using the AFL command
> set?
>
>
> Thank you,
>
> Ryan
>
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
> 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
>
>
> 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

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to