Trading Hours Start / End Time referenced by AFL

I've been looking for ways to reference Intraday settings parameters like Trading Hours Start and End within AFL as shown below.
It is possible that I am not looking in the right places while searching for this information, but I'd appreciate if anyone knows of a way to access this Amibroker database configuration parameter via AFL.

Thank you ..


Not that I know, but this only changes if user changes it. You can save these informations as persistent static variables and read in AFL.

1 Like

@awilson Thank you for your confirmation. Yeah, static variables could help, or perhaps an external csv file read by AFL.

My database config has a number of different Groups of stocks on different World Exchanges so the Trading hours are different from one Exchange to to other.
My intention was to reference Exchange specific trading times for certain groups of stocks needed for some time-related calculations that are more of a cosmetic nature, such as remaining time to the next candle etc... Nice to have, but not really necessary.

I any case, thank you for your reply ...

Kind Regards

Can you read that page of the manual i think will help you, special the last bit of the page about groups

Then you can click on Intraday Settings button to display per-group settings. Please note that each group in the category list can have its own individual settings so you can easily setup groups so they contain instruments traded in different hours

Thank you for your suggestion.

My challenge is not how to setup groups with their specific config parameters but rather how to access different settings for each group from within AFL program.

I've been using groups with different parameters for a long time, but I don't know of a way to use those different parameters inside AFL program to do time calculations for example.

@awilson suggested using static variables and that approach would work.
I can also reference an external file using AFL program , like a text file that would store those group specific parameters.

Hope I made some sense, but thank for the suggestion anyway.

Kind Regards,

hello @Ziza

Yes @awilson he hit to the point correct.
Also me i read on your title “ referenced by afl“ but I confuse. Sorry.
Can you make it more clear when you say "program to do time calculations for example" what exaclty you mean?in your previous message you said "time-related calculations.....remaining time to the next candle"

Personally i never try. But i think time-remaining should work if you set up the groups in the category list.


For example, Sydney ASX Exchange opens at 10am (Sydney time). Dow Jones, in New York, opens however at 9:30 am New York time. So their individual Group Time config parameter , as defined by the group config, is different.

Suppose I want to display time until the next hourly candle. Let's also suppose the local time where I am in Sydney, is 10:45 am.

When ASX trading starts at 10am, hourly candles will appear on chart every 1 hour (i.e 11, 12,13 etc). Given that now is 10:45am I will have to wait for 15 minutes before the new interval of 1 hour starts and the new candle appears. My chart for ASX Sydney stock should display remaining time to the next candle as 15 minutes.

But my chart for a stock listed in New York, should display 45 minutes to the next candle because the next hourly candle for New York will happen at 11:30. since New York trading started at 9:30am and hourly candle appears every 1 hour starting from 9:30am (i.e 10:30, 11:30, 12:30 ...)

So when I say "to do some time calculations", I would like to be able to read the config parameter (10am for Sydney and 9:30am for New York) inside my AFL program, so that I can calculate the time remaining until the next candle.

Since AFL cannot access (read) Amibroker database group specific parameters, I can easily achieve the above if I keep these group specific parameters either in an external file or static variables. Then my AFL program can read external file or static variables and do whatever it needs to do with those parameters.

Hope this makes sense.