Intraday Chart Intervals and What They Cost
Two settings decide what an intraday chart can show you, and only one of them is on the View menu. The chart interval is a per-window display choice you can change forty times a minute. The base interval is a property of the database, fixed in practice when the database was created, and it sets a floor that no display choice can dig under. Nearly every intraday complaint that begins “the 5-minute option is greyed out” or “my chart has no data before Tuesday” is that distinction, arriving late.
By the end of this lesson you should be able to say which intervals your database can offer and why, choose one for a purpose rather than out of habit, calculate before you build a layout how many bars it will hold and what those bars cost in memory, and read the single number in AmiBroker’s status bar that tells you when you have asked for more than the machine can deliver.
The interval is a display choice; the base interval is a floor
Section titled “The interval is a display choice; the base interval is a floor”File → Database Settings → Base time interval defines the smallest bar the database stores.
Everything coarser than that is produced by time compression, on demand, when you ask for it.
Nothing finer is ever available, because the finer bars were never stored.
The User’s Guide is blunt about the consequence: intraday intervals are disabled entirely if the database is in end-of-day mode, and if you set the base interval to 5-minute then every chart periodicity from 5-minute up becomes available — and nothing below.
Where a 15-minute chart comes from
- 15-minute chartWhat you asked the window to draw
- On-the-fly time compressionPerformed when the pane executes. Nothing is stored
- 1-minute bars in the databaseThe base interval. The finest grain that exists
- Ticks at the pluginPacked into base-interval bars as they arrivenever stored as ticks unless the base interval is tick
Two practical rules fall out of this immediately.
Compression is free-ish; decompression is impossible. You can always look at a coarser interval than your base. You can never look at a finer one. This is why Part 19 spends a whole lesson on the base-interval decision: it is the one database setting whose cost is irreversible. Changing the control later does not retroactively create finer data — the bars were already packed. You would need a new database and a fresh collection or import.
The interval setting affects the active window only. Each chart window carries its own periodicity, which is exactly what makes a multi-timeframe layout possible: link two windows by symbol, leave their intervals unlinked, and one click on the symbol tree moves both.
The intervals AmiBroker offers
Section titled “The intervals AmiBroker offers”The built-in list, as documented in the charting chapter:
| Interval | Toolbar | Notes |
|---|---|---|
| Daily, weekly, monthly | d, w, m |
Also quarterly and yearly, from the View menu |
| Hourly | h |
Intraday |
| 15-minute, 5-minute, 1-minute | i shows the base intraday interval |
Intraday |
| 15-second, 5-second | — | Documented as “intraday real-time only” |
| Tick | — | Documented as “intraday real-time only” |
Beyond those you get five custom n-minute intervals and five custom n-tick intervals,
defined in Tools → Preferences → Intraday. Two things trip people up here: custom intervals
never appear on the toolbar and are reachable only from View → Intraday, and since version
5.60 there is also an interval combo box that accepts an interval typed by hand, which makes
the five-slot limit much less painful than it sounds.
Two settings that change what your timestamps mean
Section titled “Two settings that change what your timestamps mean”Both live on the Intraday tab of Preferences, and both change what your AFL sees rather than just what the chart looks like.
“Time compressed bars show” chooses whether a compressed bar is stamped with its first
tick, its last tick, the start time of the interval or the end time. A 30-minute bar covering
09:00:00–09:29:59 is stamped 09:00 or 09:29:59 depending on this. Every TimeNum()
comparison you write inherits that choice, which is why an opening-range filter can work on
your machine and fail on a colleague’s.
“Align custom minute bars to regular market hours” decides whether a 45-minute bar series starts at 09:00 / 09:45 / 10:30 or aligns to the session open. Part 20 shows what happens when this is wrong.
Choosing between 1, 5, 15 minute and hourly
Section titled “Choosing between 1, 5, 15 minute and hourly”Start from arithmetic rather than from preference. For a 6.5-hour session, the bar counts are fixed by division:
| Interval | Bars per 6.5-hour session | Bars in 20 sessions |
|---|---|---|
| 1-minute | 390 | 7,800 |
| 5-minute | 78 | 1,560 |
| 15-minute | 26 | 520 |
| Hourly | 6.5 | 130 |
Those are arithmetic, not measurements; substitute your own session length. What they tell you is that the interval choice is simultaneously a resolution choice, a memory choice and a statistics choice. A month of 1-minute bars gives an indicator sixty times more observations than a month of hourly bars, and sixty times more opportunities for a threshold to be crossed by noise.
The honest way to describe the trade-off is in terms of what each choice does to the inputs, not to the profits:
- A shorter interval reports more of what happened. It also reports more of what happened that had nothing to do with anything — a single large order, a quote glitch, a one-tick spread bounce. Any indicator you compute on it inherits that.
- A longer interval smooths by construction, and delays by construction. A 15-minute bar tells you nothing until 15 minutes have passed.
- Session structure gets coarser as the interval grows. On hourly bars a 6.5-hour session is six and a half bars, so “the opening range” and “the last hour” stop being separable ideas.
Tick and second intervals, where they are supported
Section titled “Tick and second intervals, where they are supported”Two conditions must both be met before a tick or N-second chart is possible, and either one can block you.
The edition. The official edition comparison lists “Tick charts/backtesting/scanning” and “1-second, 5-second, 15-second bar charts/backtesting/scanning” as Professional only. Standard supports 1-minute and above. This is one of the six or so capabilities the documentation genuinely gates behind Professional.
The feed. The same table’s footnote restricts tick support to eSignal RT, Interactive Brokers or a DDE feed, and the base interval combo only offers tick, 5-second and 15-second for sources that support them. A Professional licence on a feed that does not deliver sub-minute data still gets you nothing below a minute.
Even where both conditions are met, the provider documentation is worth reading before you commit a database to tick:
- AmiBroker’s own Interactive Brokers page states that TWS streaming data are 0.2–0.3 second snapshots rather than a true tick-by-tick stream, and recommends 5-second, 15-second or preferably 1-minute base intervals instead of tick.
- The IQFeed page states in capitals that the feed is unfiltered and that you should expect bad ticks, and records an IQConnect ceiling of five million ticks or bars per symbol.
- The eSignal page warns that tick and second base intervals pull enormous volumes for very little history, and recommends 1-second bars over pure ticks because that mode is faster.
Those pages carry their own dates and vendor terms change; Part 18 holds the provider appendices, with what was verified and what was not. Treat sub-minute work as a decision with a storage bill and a data-quality bill attached, not as a free upgrade in resolution.
How many bars to display, and the three numbers that control it
Section titled “How many bars to display, and the three numbers that control it”Three different settings are all sometimes called “how many bars”. They do different jobs.
File → Database Settings → Number of bars to loadcaps how many bars per symbol AmiBroker loads from the data source and holds in memory. This is the one with a memory bill.Tools → Preferences → Charting → Default number of quotations in a chartsets whatView → Zoom → Normalreturns to. It is a viewing default and costs nothing.- The zoom itself —
CTRLplus the mouse wheel, the zoom toolbar, or dragging the edge of the scroll bar. Note that Zoom In reduces the number of bars shown, which reads backwards to most people.
The memory arithmetic for the first is documented and simple: one data bar is 40 bytes. So 100,000 bars is 4 MB per symbol, actually allocated. The performance chapter’s own worked example points out that with a 500-symbol in-memory cache that reaches around 2 GB, and recommends not exceeding 100,000 bars so that the working set has a chance of staying inside the CPU’s on-chip cache. The Database Settings dialog helpfully prints the day-equivalent of the number you typed for your base interval — read it before accepting the number.
There is a fourth number that nobody sets: a chart pane may receive fewer bars than the
database holds, because QuickAFL calculates only the visible part of the array plus a computed
margin. That is why BarCount inside a chart formula can be smaller than the database’s
number-of-bars setting, and it is a feature rather than a fault. The AFL parts of the course
deal with it properly; here it is enough to know that the number in a pane is the pane’s number.
The bill arrives in the status bar
Section titled “The bill arrives in the status bar”AmiBroker publishes a single number that tells you whether your layout is affordable. On the rightmost side of the status bar it shows, for real-time databases, a percentage load factor; for offline, intraday and end-of-day databases it shows free virtual memory instead.
The load factor is documented as:
(total chart refresh time in ms) / 2 + (total data access time in ms) / 2 + (free virtual memory below 20% of total)so it reaches 100% if total chart refresh time exceeds 200 ms, or total data access time exceeds 200 ms, or free virtual memory drops below 10% of total — or a combination.
The two components are worth separating in your head, because they have different fixes. Total chart refresh time is the sum of the times to redraw every chart on screen, including AFL execution for each pane and the graphics output; it does not include data access. Total data access time is the time to get fresh data through the plugin for every displayed symbol, plus time filtering and compression from the base interval to the displayed interval. The documentation adds a diagnostic threshold: if plug-in time per symbol exceeds 10 ms, the plugin itself is slow and the vendor should be asked for an updated one.
The documented interpretation:
| Load factor | What the guide says |
|---|---|
| ≤ 100% | Charts update more than five times a second, interface stays smooth. Recommended |
| 200% | Still about 2.5 updates a second; interface reaction may be impaired. The maximum for “more or less normal” operation |
| > 100% | A warning tooltip pops up once, saying what the cause is |
| > 300% | That tooltip reappears every minute |
| > 1000% | Still works, but one update per five seconds or worse |
The other half of the cost model is threads. AmiBroker’s documented rule is one operation on one symbol equals one thread, and displaying a single chart pane is one operation. A chart window with four panes is four threads on one symbol; three such windows is twelve. Charts are threaded independently of the Analysis window, whose thread count is edition-limited — Standard to 2, Professional to 32, and in both cases never more than the number of logical processors Windows reports.
A formula that prices the pane you are looking at
Section titled “A formula that prices the pane you are looking at”Before adding another pane, you want three numbers you cannot get from the interface at a glance: how many bars this pane actually received, how many of them one session accounts for, and what the series costs in memory once the in-memory cache is multiplied in. The panel below reports them, plus the compression ratio between your base interval and the displayed one.
Complete formula
Section titled “Complete formula”Complete runnable AFL
_SECTION_BEGIN( "Interval budget" );
/* Interval budget - Part 21, Real-Time Charts.
WHAT IT DOES Reports what this chart pane is actually working on: which interval it draws, how many bars it received, how many of those bars one trading session accounts for, and what the loaded series costs in memory. Read it before you add a fourth pane to a live layout.
ASSUMPTIONS - read these before trusting any number below - One stored data bar occupies 40 bytes. That figure is AmiBroker's own, from the "Performance tuning tips" chapter of the User's Guide. - BarCount is the number of bars THIS pane received. It is capped by File -> Database Settings -> "Number of bars to load", and a chart pane may legitimately receive fewer than that, because AmiBroker trims the array to what the chart needs. - AFL has no documented function that reports the database base interval, so the base interval below is a parameter. Read it once from File -> Database Settings and type it in. - Interval( 0 ) returns 0 for tick charts, because a tick bar has no duration. Every ratio is therefore guarded. - The session length is yours to state. Nothing in the database tells this formula how long your trading session is.*/
BytesPerBar = 40; // documented in the User's GuideBytesPerMb = 1048576;
BaseSeconds = Param( "Database base interval (seconds)", 60, 1, 86400, 1 );CacheSymbols = Param( "In-memory cache (symbols)", 200, 11, 5000, 1 );SessionHours = Param( "Session length (hours)", 6.5, 0.5, 24, 0.5 );
ChartSeconds = Interval( 0 );ChartLabel = Interval( 2 );
BarsLoaded = BarCount;MbPerSymbol = BarsLoaded * BytesPerBar / BytesPerMb;MbForCache = MbPerSymbol * CacheSymbols;
// How many base-interval bars are packed into one bar of this chart.if( ChartSeconds > 0 AND BaseSeconds > 0 ){ PackedBars = ChartSeconds / BaseSeconds; PackedText = NumToStr( PackedBars, 1.1 ) + " base bars per displayed bar"; SecondsText = NumToStr( ChartSeconds, 1.0 );}else{ PackedText = "not a time ratio (tick interval)"; SecondsText = "0 - tick bars";}
if( ChartSeconds > 0 ){ BarsPerSession = SessionHours * 3600 / ChartSeconds; SessionText = NumToStr( BarsPerSession, 1.0 ) + " bars per " + NumToStr( SessionHours, 1.1 ) + "-hour session";}else{ SessionText = "tick charts have no bars-per-session figure";}
SetChartOptions( 2, chartWrapTitle );Plot( Close, "Close", colorDefault, styleCandle );
Report = EncodeColor( colorDefault ) + Name() + " interval: " + ChartLabel + "\n" + "Chart interval in seconds: " + SecondsText + "\n" + "Compression: " + PackedText + "\n" + "Bars in this pane: " + NumToStr( BarsLoaded, 1.0 ) + " " + SessionText + "\n" + "Memory for this series: " + NumToStr( MbPerSymbol, 1.2 ) + " MB per symbol\n" + "A cache of " + NumToStr( CacheSymbols, 1.0 ) + " symbols at this size: " + NumToStr( MbForCache, 1.0 ) + " MB";
Title = Report;
_SECTION_END();How it works
Section titled “How it works”The formula has three sections. The first reads what AmiBroker can tell it: Interval(0)
returns the chart interval in seconds and Interval(2) returns its name, and BarCount gives
the number of bars the pane received. The second does arithmetic that AFL cannot look up —
compression ratio, bars per session, megabytes — using values you supply through Param(),
because there is no documented AFL function that reports the database base interval and nothing
in the database knows how long your trading session is. The third assembles a title, using
SetChartOptions(2, chartWrapTitle) so a long report wraps instead of being cut off.
Every division is guarded, because Interval(0) returns zero on a tick chart. A tick bar has
no duration, so “bars per session” and “base bars per displayed bar” are not questions that
have answers there, and the formula says so rather than dividing by zero.
Key functions
Section titled “Key functions”Interval( format )— returns the bar interval of the chart. Format 0 gives seconds, format 1 returns tick intervals as a negative number, format 2 gives a name such as “15-minute”. The documentation warns against comparing the format-2 string, because a localised build would translate it; compare numerically againstinDaily,inHourlyand friends instead.NumToStr( number, format )— the1.0format means no decimal places,1.2means two.EncodeColor( color )— emits the escape sequence that colours the following text in a chart title.SetChartOptions( 2, chartWrapTitle )— mode 2 sets a flag without disturbing others.
Expected result
Section titled “Expected result”A candlestick pane whose title reads something like: the symbol and interval on the first line, the interval in seconds, the compression ratio, the bar count with the bars-per-session figure beside it, the megabytes for the loaded series, and the megabytes if your cache held that many symbols at that size.
Test it
Section titled “Test it”Switch the chart between 1-minute, 5-minute and 15-minute with the same parameters. The compression ratio should change by exactly the ratio of the intervals, the bars-per-session figure should divide accordingly, and if your database’s number-of-bars setting is the binding limit, the bar count should stay roughly constant while the days-of-history it represents grows. If the bar count falls as you go coarser, the database, not the setting, is your limit.
Common errors
Section titled “Common errors”- Setting the base-interval parameter to something the database does not use. The formula cannot detect the error; a compression ratio below 1 is the symptom, and it means you claimed a base interval coarser than the chart you are drawing.
- Reading the megabyte figure as the size of the database on disk. It is the memory for this one series of this one symbol at this one bar count.
- Expecting
BarCountto equal the number-of-bars setting. QuickAFL may have given the pane fewer bars, and that is normal.
Extension
Section titled “Extension”Add a Param() for the number of panes in your layout and multiply the chart-refresh cost:
one pane equals one thread, so a rough “threads this layout will use” figure is panes multiplied
by windows. Compare it with your processor’s logical core count and with the load factor in the
status bar.
If you have no intraday feed
Section titled “If you have no intraday feed”Everything above except the tick and second intervals is reproducible with no subscription at all. What you need is an intraday database — one whose base interval is below end-of-day — and some bars in it. Part 19 builds exactly that, and its Level A path fills it from historical intraday text files through the ASCII importer rather than from a live plugin.
With that database in place: the interval menu behaves identically, compression from the base
interval upward is the same code path, Interval() returns the same values, the bar arithmetic
is the same arithmetic, and the 40-bytes-per-bar memory bill is unchanged. What you will not
see is a load factor in the status bar, because that display is documented as appearing for
real-time databases; an offline or intraday database shows free virtual memory in that position
instead. That difference is itself worth noticing, and the next lesson makes use of it.
The chart interval is a window property; the base interval is a database property and a floor. Compression upward happens on demand and stores nothing; decompression downward is not a thing. Tick and N-second intervals need both the Professional edition and a feed that supplies them, and several timing facilities documented as time-based-only stop working there. The number of bars you load has a documented price of 40 bytes each, multiplied by your cache; the number of panes you open has a price in threads and refresh time; and AmiBroker reports the combined bill as a load factor whose recommended ceiling is 100%.
The next lesson takes the two components of that load factor — data access and chart refresh — and shows why they are separate events, and why confusing them is the root of most reports that a chart has broken.
Check your understanding
Sources for this lesson
9 verified · checked 2026-08-31
- 01AmiBroker User's Guide — Beginners' charting guide§ Changing bar interval (periodicity)amibroker.com/guide/h_charting.html2026-08-31
- 02AmiBroker User's Guide — Database Settings§ Base time intervalamibroker.com/guide/w_dbsettings.html2026-08-31
- 03AmiBroker User's Guide — Preferences§ Intraday and Charting tabsamibroker.com/guide/w_preferences.html2026-08-31
- 04AmiBroker User's Guide — Performance tuning tipsamibroker.com/guide/x_performance.html2026-08-31
- 05AmiBroker User's Guide — About AmiBroker editionsamibroker.com/guide/versions.html2026-08-31
- 06AmiBroker User's Guide — Efficient use of multithreadingamibroker.com/guide/h_multithreading.html2026-08-31
- 07AFL Function Reference — Intervalamibroker.com/guide/afl/interval.html2026-08-31
- 08AFL Function Reference — Statusamibroker.com/guide/afl/status.html2026-08-31
- 09AmiBroker Knowledge Base — QuickAFL factsamibroker.com/kb/2008/07/03/quickafl2026-08-31
Every technical claim on this page was checked against the official AmiBroker documentation on the date shown. Where the course disagrees with folklore, the source is how you can tell which one to trust.