Show LasteValue(datetime()) of intraday data in Daily Chart

Hi all,
I think I have the same issue as @travick issue where I want to show the last DateTime() value of the intraday data in my Daily chart. Even after selecting 'time of LAST tick inside bar' i still cannot see the value being shown.

TimeFrameSet( 1 ); //1 second
dt = DateTime();
lastUpdateTime = LastValue(dt);
"Last Update: " + DateTimeFormat("%H:%M:%S", lastUpdateTime );
TimeFrameRestore(); //1 second

The output in my daily chart is: "Last Update: 00:00:00"

Noted that the above does not work because of here: [Multiple Time Frame support in AFL] (https://www.amibroker.com/guide/h_timeframe.html) says "PLEASE NOTE that you can only compress data from shorter interval to longer interval"

Is there any way we can get this?

Edit: My database Base time interval is: tick

Thanks @ali.net for your suggestion. I modified your code to this:

d = LastValue(DateTime());
dts = DateTimeToStr( d);
printf("Last Update: "+ dts + "\n");

When I choose any intraday view, AB will show full date and time:
(Last Update: 17/12/19 12:29:46 PM)

But it's only showing the Date only when I switch to Daily view:
(Last Update: 17/12/19)

I just realised that I enabled * Allow mixed EOD/Intraday data in my database setting. By doing this Amibroker will use my EOD data when I'm viewing Daily chart and cannot 'see' my Intraday data.

from Amibroker manual:
" Database Settings / Intraday Settings

  • Allow mixed EOD/Intraday data - it allows to work with database that has a mixture of intraday and EOD data in one data file. If this is turned on then in intraday modes EOD bars are removed on-the-fly and in daily mode EOD bars are displayed instead of time compressed intraday or if there is no EOD bar for corresponding day then intraday bars are compressed as usual."

This could be the reason.

1 Like

The "solutions" given in this thread are simply wrong. Also your question is missing crucial information: the DATA SOURCE you are using. Do I have magic mirror to guess???

In "EOD" or Daily mode bars have EOD marker (so they don't have "time" component).

Also you can not use TimeFrameSet to switch DAILY chart to 1-second because you can only change intervals from fine grained (1-second) to coarser (daily) not the other way round as explained zillions of times on this forum and in the documentation
http://www.amibroker.com/guide/h_timeframe.html

Correct way is to use http://www.amibroker.com/guide/afl/status.html

Status("lastrtupdate");

or GetRTData http://www.amibroker.com/guide/afl/getrtdata.html

GetRTData("UpdateTime");

provided that you use real time data.

Thirdly, why do you create new thread when it should go to the old one.

1 Like

Duplicate of: Retrieve timestamp of latest bar in Local DB