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