amibroker

HomeKnowledge Base

How does the intraday-to-daily compression work?

When you are using intraday database daily candles are usually constructed by time-compression of intraday (for example 1-minute data). AmiBroker offers lots of flexibility when it comes to defining intraday-to-daily time compression.

Intraday Settings Window (File -> Database Settings -> Intraday Settings) allows you to control the display of intraday data. Different filtering and data-compression settings result in different appearance of the chart and data being included in the compressed DAILY candle.

This article explains how to use this feature effectively.

First, let us check how Filtering works  AmiBroker collects all the data within the local database, but displays only those data which are inside selected trading hours start-end time. Please note that these settings affect all charts and windows except Quote Editor that always displays all available data.

  • Show 24 hours trading (no filtering) – all data is displayed (no filtering at all). In this case, all the data (including pre- and after-market quotations) is shown on the chart, and all the quotations are compressed to the daily bar.

24 Hours - Daily compression uses Exchange time
 

As a result – all the data (since 00:00 untill 23:59) is included on the intraday chart. Now, if we switch the display into DAILY interval, all these quotes will be compressed to the daily candle.

As it is visible in the tooltip – the OHLC values shown for the 2006-03-14 candle match the values observed on the intraday (5-min) chart.

  • Show day session only – only the data between day session (RTH) start and end times is displayed. If we apply such kind of filtering, the quotes outside the regular session hours are not included in the charts.

These are the settings we want to use if we are interested in getting daily bar representing standard US stock markets trading hours (9:30 open, 16:00 close). If we switch the display to DAILY interval, the influence of the filtering settings can also be observed.

As it is visible in the tooltip – the OHLC values shown for the 2006-03-14 candle match the values from 9:30 upto 16:00 observed on the intraday (5-min) chart.

  • Show night session only – only the data between night sesison (ETH) start and times are displayed. The below chart shows only the data between start and end times of the Night session defined in the settings.

Since only Night-session data is displayed in the charts, consequently, such data will be included in the Daily candle when we switch the display interval to DAILY.

 

Daily candle includes all the quotes for 2006-03-14 (marked with yellow background on the previous / intraday picture)

Now we will examine how does the time-shift affect the daily compression. Let us consider the Europe-based investor in GMT+1 time zone. There is a 6 hours difference, that is – when the regular session starts in US at 9:30, the time here is 15:30. That’s what the time-shift setting is for. If one wants to, it’s possible to display the quotations in the local time.

Time shift – is the time difference (in hours) between your local time zone and the exchange time zone. So – let’s set the time-shift to 6 hours and check what’s the influence of this setting on the daily compression.

AmiBroker allows us to choose, whether the daily time-compression uses Exchange time or Local time.

  • Exchange time – daily data are constructed from intraday bars starting from 00:00 and ending at 23:59 in the EXCHANGE (or data source) TIME ZONE. This situation is presented in the screenshot below:
     

 

The yellow shade shows the bars which are used to build the 2006-03-14 daily candle. Despite the fact that the day expressed in Local time starts at 00:00, daily time-compression uses EXCHANGE time (so in local time, the new trading day starts at 6:00 and ends at 5:59, which is just 00:00 shifted by 6 hours). Consequently – if EXCHANGE time is used for the daily compression then the Daily bar will look exactly the same as in US-time (first example in this article).

As you can see – the Open, High, Low, Close prices of the 2006-03-14 daily candle are exactly the same as in Example 1, when there was no time-shift used. This is because the compression still uses EXCHANGE 00:00 – 23:59 range, which is expressed as 6:00 – 5:59 in local time.

  • Local time – daily data are constructed from intraday bars starting from 00:00 and ending at 23:59 in the LOCAL (computer) TIME ZONE.

As opposed to the previous example – now AmiBroker uses 00:00 – 23:59 range expressed in Local time. That will produce a different daily candle.

It’s also possible to use Day/Night session times defined in the settings for daily compression purposes. 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). So – if we define the day session to start at: 9:30 and finish at 16:00 and night session times as 16:01 – 9:29, then the daily candles will be built from all the intraday bars from the start of the night session on the PREVIOUS day till the very last bar of the day session of the CURRENT day. Such setup is popular in Forex markets where Monday’s daily bar actually starts with Sunday evening trading (which starts from 17:00 ET) and continues till the end of Monday’s day session, and so on for each next day.

And the daily candle of March 14th shows these values – so the daily compression uses time range from: March 13th (previous day) 16:01 to March 14th (current day), 16:00.

See also:
Detailed setup instructions for Tokyo-based Forex traders using eSignal feed.

2 Responses to “How does the intraday-to-daily compression work?”

  1. Tony
    March 17th, 2007 | 8:46 pm

    Being new to charting this really helped me understand, why the charts used to look very different, when I changed time-scales. I used to think that AmiBroker was displaying incorrect information.

    I am glad I read this.

  2. Igor
    April 16th, 2007 | 2:31 am

    Please correct me if I am wrong. As ‘Intraday Settings’ is a database scope setting you have to store futures traded 9:30-16:00 (ER2) in one database and ones traded 24 hours (ZG) in another database as otherwise you can not look on ER2 day session and ZG 24 hours session within the same database.

    Thank you,

    Igor