timeFrameSet Hourly to Daily DailyClose not as expected


I have an issue working with timeframes.
I use a 1 hour timeFrame database and I want to compute misc parameters on daily timeframe based on previous day close.
Here is a sample code:

	TimeFrameSet( inDaily ); 
	CloseDaily = C; 
	TimeFrameRestore( ); 
	AddColumn (TimeFrameExpand(CloseDaily,inDaily),"CloseDaily");
	AddColumn (Close,"C");
	Filter = 1; 

The issue is that Close seems to be delayed by 1 day (minus 1 bar).

Here is what I obtain when I run an exploration on daily DB and on 1hour DB
2022-09-01 17_31_15-AmiBroker
Daily DB

2022-09-01 17_33_07-AmiBroker
1 hour DB

In the example above, I would like to have
Date/Time CloseDaily expected CloseDaily Actual
2022-08-26 15:30:00 34.97 36.96
2022-08-26 16:00:00 34.97 36.96
2022-08-26 16:00:00 34.97 36.96
… … …
2022-08-26 16:00:00 34.97 36.96
2022-08-26 21:00:00 34.97 34.97

How can I get correct result, ie, dailyClose expanded with the Close of the current day for all the previous hours of the day ?
Is this behavior due to US opening hours is not a multiple of Hours ?


You need to observe difference between different expand modes. By default it is expandLast to prevent looking into the future. expandLast as name says, uses LAST bar within given day

See the docs

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.