Mixing market hours daily w/ intraday premarket+afterhours

I use show 24 hour trading database settings to access to premarket on 1 minute bars. The daily chart and AFL time compression from 1-min give daily bars with open and close from premarket and afterhours. If I filter market hours I cannot see/access premarket on 1-min.

Ideal scenario: daily charts and time compression provide market hours bars, 1-min charts and AFL include premarket/afterhours (i.e. just like you'd expect to see on your broker software).

Do I need to implement my own "market hours time compression" in AFL, or is there a simpler solution to this?


1 Like

See Knowledge Base

@Tomasz Thanks for the reference. I've read and re-read that, tried tuning those settings, and am not able to achieve the scenario I described. Just to be clear, are you inferring that documentation indicates one can, or cannot, achieve what I described using just the database Intraday settings? Thanks.

The KB explains that there is a setting in the Intraday Settings that allows to use Day/ night Session time as the base for user defined Intraday to daily compression

Then daily candles are constructed from the intraday bars that start at the start time of night session (previous day) and end at the end time of day session).

Thanks Tomasz. The language of this seems to indicate it cannot fit my scenario (?). My understanding is that setting will form the daily candles spanning from night of one day to morning of next day. But I'm looking for daily candles to be constructed from the 9:30am-4pm bars on the same day, excluding the premarket 4am-9:30 and aftermarket 4pm-8pm bars. I know the setting says "day/night", but I only see that it constructs candles from night. Do I need to combine with time shift or something?


These settings intuitively make sense, kinda, but does not achieve the goal of 9:30-4pm daily compression.

Pretty embarrassed I can't figure out step 0. Thanks for bearing with me.

@Tomasz I do see that SparseCompress may be an option to do this on my own in AFL, which I could also combine with using mixed EOD/intraday to ensure the daily chart looks as I expect as well. Of course if one of these intraday settings can achieve it that would be much more convenient and intuitive. Thanks.

I promise I'm not just asking questions without doing my homework. I've managed to overflow some buffers while working on a "market hours time compression" AFL solution (report sent). I'm not quite there yet, but this is telling me to take a break tonight.


Hopefully I'll have some kind of solution going before too long that I can share.

Please send full report ("Copy to clip" button) as text, nor as truncated image.

@Tomasz I sent it through the in-built "send report" button and added the full script and description there.

Use what is said in the Knowledge Base. You don’t need ANY formula.
When you need premarket you choose 24 hours (no filtering), when you need day session you choose that from filtering menu. You can even have key shortcut to switch between the two in a blink of the eye. As simple as it can only be.

Also if you are using the data feed that supports for mixed data like IQFeed or eSignal (selectable in File->Database Settings->Intraday Settings) you can just enable Mixed Intraday / EOD mode.

If you are using offline data, you can also use mixed mode and import both intraday and EOD data at the same time and use Mixed mode.

Topic is solved in Mixing market hours daily w/ intraday premarket+afterhours - #2