Thanks, Tom and reinsley. Much appreciated. Regards, Ray Micaletti
--- In [email protected], Tom Klopfstein <bluues...@...> wrote: > > You could adapt something from this script I put up recently: http://www.amibroker.com/library/detail.php?id=1263. > > --- On Thu, 9/10/09, rmicalet rmica...@... wrote: > > > From: rmicalet rmica...@... > Subject: [amibroker] Retrieving yesterday's daily O/H/L/C during RTH in an intraday database? > To: [email protected] > Date: Thursday, September 10, 2009, 12:45 AM > > > > > > > Does anyone happen to know how to do the following: > > I have a one-minute database that shows 24 hours of data. To compute > pivots, I'd like to retrieve yesterday's O/H/L/C, but only from the > regular trading session (9:30 am to 4:00 pm, New York time). If I simply > take the O/H/L/C of the previous day's data I'll get the values > corresponding to the entire 24 hour range of prices. Ideally, I'd like > to isolate the one-minute bars from yesterday at 9:30 am to yesterday at > 4:00 pm and then find the max, min, and last price. > > I imagine the solution entails something like: > > startBar = ValueWhen( timeNum() == 093000 and ???, barIndex()); > endBar = ValueWhen( timeNum() == 160000 and ???, barIndex()); > yesterday_high = HHV(barIndex( ) >= startBar AND barIndex() <= endBar, > H); > yesterday_low = LLV( barIndex() >= startBar AND barIndex() <= endBar, > L); > yesterday_close = ValueWhen(barIndex( ) == endBar, C); > > In the expressions for "startBar" and "endBar", I'm not sure how to > construct the condition that the day in question is yesterday when > dealing with a one-minute database. I tried: > > timeFrameSet( inDaily); > yesterday = Ref(Day(),-1) ; > timeFrameRestore( ); > > startBar = ValueWhen ( timeNum() == 093000 AND Day() == yesterday, > BarIndex()); > endBar = ValueWhen ( timeNum() == 160000 AND Day() == yesterday, > BarIndex()); > > But that doesn't seem to work as no indicators show up when I plot them > out. > > I suspect I'm making this a lot harder than it is. Would be grateful for > any insight. > > Regards, > Ray Micaletti >
