The Base Interval Decision
There is a combo box in the Database Settings dialog labelled Base time interval. Setting it takes four seconds. It decides which questions this database will be able to answer for as long as it exists, and there is no setting, licence, subscription or upgrade that changes that afterwards.
This lesson is about making that choice deliberately: what the control governs, what it costs at each setting, and why the obvious escape route — “I will pick something coarse now and change it if I need to” — leads to re-collecting your entire history rather than to a different database.
The grain, and everything above it
Section titled “The grain, and everything above it”An AmiBroker database stores bars at exactly one interval. That interval is the base time interval, and the User’s Guide’s word for it is the grain: the smallest unit of price history the database physically holds.
Every other interval you see in AmiBroker is produced from that grain by time compression, calculated when you ask for it and thrown away afterwards. You never download five-minute bars and one-minute bars separately. You store one-minute bars, and when you switch the chart to five minutes, AmiBroker groups them five at a time and draws the result.
The consequence is stated plainly in the charting chapter: set the base interval to 5-minute and every periodicity from 5-minute upwards becomes available. Set it to end-of-day and the intraday menu entries are disabled entirely — the guide’s own wording is that you will not be able to use intraday charting or analysis at all until the base interval is set to something below end-of-day.
Compression upward is free. The other direction does not exist.
Section titled “Compression upward is free. The other direction does not exist.”Take five consecutive one-minute bars and compress them into one five-minute bar. The rule is mechanical: the open of the first, the highest high, the lowest low, the close of the last, and the sum of the volumes.
Five one-minute bars compressed into one five-minute bar (illustrative values)
| Bar | 09:30 | 09:31 | 09:32 | 09:33 | 09:34 | → 09:30–09:34 |
|---|---|---|---|---|---|---|
Open | 20.00 | 20.06 | 20.11 | 20.04 | 20.02 | 20.00 |
High | 20.08 | 20.14 | 20.12 | 20.05 | 20.09 | 20.14 |
Low | 19.97 | 20.03 | 20.02 | 19.99 | 20.01 | 19.97 |
Close | 20.06 | 20.11 | 20.04 | 20.02 | 20.07 | 20.07 |
Volume | 4,200 | 3,100 | 2,700 | 1,900 | 3,400 | 15,300 |
Now try to work backwards. From the five-minute bar alone you know the session opened at 20.00, traded as high as 20.14 and as low as 19.97, and closed the five minutes at 20.07 on 15,300 shares. You do not know which minute the high happened in. You do not know whether the low came before or after it. You do not know whether price went up and then down or down and then up, whether the volume arrived evenly or all in one minute, or whether there was a minute in there with no trading at all.
That information is not hidden, compressed or locked. It was never written down. Compression is a projection: many inputs map to the same output, so the output cannot identify its input.
Everything else about the base interval follows from this one fact.
What “you cannot change it later” actually means
Section titled “What “you cannot change it later” actually means”It is worth being precise here, because the folklore and the documentation say slightly different things.
The Base time interval control sits in the Data source half of the Database Settings dialog. The guide describes the General half — the folder name and the Create button — as being enabled only at database creation time, and the Data source half as remaining usable afterwards through File → Database Settings. So the guide does not say the combo box is permanently greyed out, and this course will not tell you it is. What the guide does say, about real-time sources, is that the base interval should be set once at the database creation time, because a real-time source collects ticks and packs them into interval bars, and this setting defines the minimum grain it packs to.
The reason the advice is so firm is physical rather than a matter of the user interface. Suppose you built a five-minute database, ran it for six months, and now change the setting to one minute. Nothing in your six months of stored bars becomes finer. Those bars were compressed on the way in and the discarded detail is gone. From the moment of the change, new bars arrive at the new grain, so you now own a database with a coarse past, a fine present and a discontinuity in the middle — which is worse than either.
What actually happens when you change the base interval on a populated database
- Six months of 5-minute bars are already storedEach one is a lossy summary of five minutes of trading
- You set Base time interval to 1-minuteThe control accepts it
- The stored history does not changeThere is nothing to un-compress; the detail was never written
- New bars arrive at 1-minuteFrom now on only
- Your database now has two grains with a seam between themAny study spanning the seam is measuring the seam
- The real fix: a new database at the finer grain, re-populatedWhich is what you would have done anyway
The practical rule: treat the base interval as a property of the database, not a setting of it. If you need a finer grain, you need a different database.
Choosing: 1-minute, 5-minute or tick
Section titled “Choosing: 1-minute, 5-minute or tick”Three questions decide it, in this order.
What is the finest thing you want to ask about? Not the finest chart you imagine looking at — the finest measurement your rules will make. An opening range defined as the first fifteen minutes needs bars that fit inside fifteen minutes; one-minute bars give you fifteen of them, five-minute bars give you three, and three is enough to define the range but not enough to see how it was built. A rule that reacts to the first one-minute close above the range needs one-minute bars by definition.
What can your data source actually deliver, and what does your edition allow? These are two separate constraints and both bite.
What are you willing to store and wait for? Covered in the next section.
| Base interval | What it supports | Edition | Typical use |
|---|---|---|---|
| Tick | Every interval above it, plus N-tick and N-second charts, Time & Sales style study | Professional only | Order-flow and microstructure study, very short symbol lists |
| 5-second / 15-second | Everything from 5 or 15 seconds up | Professional only | Fast intraday work where the minute is too coarse |
| 1-minute | Everything from 1 minute up: 1, 5, 15, 30, 60 minutes, daily and above | Standard and Professional | The default choice for intraday trading research |
| 5-minute | Everything from 5 minutes up | Standard and Professional | Longer-horizon intraday and swing work, much smaller database |
| End-of-day | Daily and above only. No intraday charts at all | Standard and Professional | Position and swing research, long histories |
There is also a source-side constraint that has nothing to do with your preferences. AmiBroker’s plug-in documentation is explicit that not every feed offers every grain: the myTrack page states that plug-in supports only 1-minute and daily, and the IQFeed setup walkthrough selects 1-minute. A base interval finer than your feed can deliver produces a database with a grain it can never fill.
What each choice costs
Section titled “What each choice costs”The arithmetic is worth doing once, on paper, before you touch the dialog.
A United States equity regular session runs 09:30 to 16:00, which is 390 minutes. So one regular session is:
| Base interval | Bars in one 390-minute session |
|---|---|
| 1-minute | 390 |
| 5-minute | 78 |
| 15-minute | 26 |
| Hourly | 7, depending on how the last part-hour aligns |
AmiBroker’s performance chapter gives the storage constant: one data bar is 40 bytes, and the Number of bars to load setting causes that memory to be actually allocated, per symbol. So 100,000 bars is about 4 MB per symbol, and with a 500-symbol in-memory cache the guide notes you can reach around 2 GB. The chapter’s advice is to keep the working set inside the CPU’s on-chip cache, and with a 4 MB cache it advises strongly against exceeding 100,000 bars.
Turn that into history:
| Base interval | Bars for 100 regular sessions | 30,000 bars is roughly | 100,000 bars is roughly |
|---|---|---|---|
| 1-minute | 39,000 | 77 sessions, about 15 weeks | 256 sessions, about a year |
| 5-minute | 7,800 | 384 sessions, about 18 months | 1,282 sessions, about five years |
Those are regular-hours numbers. If the feed also stores pre-market and after-hours bars, each calendar day consumes far more of your bar budget. The guide’s own IQFeed figures illustrate this: it recommends 100,000 bars on a 1-minute database to obtain the maximum history available, which it describes as about eight months. Eight months is roughly 170 sessions, and 100,000 divided by 170 is around 588 bars per session — considerably more than the 390 minutes of a regular session. That arithmetic is an inference from the guide’s own two numbers, not a vendor statement, but it points at something you should check directly on your own data: how many bars per day is your feed actually storing?
One database per purpose
Section titled “One database per purpose”There is a temptation to build one database that does everything: ten years of daily history and one-minute intraday, one place, one set of symbols. AmiBroker’s own documentation pushes back on this in two different ways.
The first is the Allow mixed EOD/Intraday data option in Intraday Settings, which lets a single database hold both true end-of-day bars and intraday bars. In intraday view modes the daily bars are dropped on the fly; in daily mode the real daily bar is preferred over one compressed from intraday. The guide names IQFeed and eSignal 1.7.0 or higher as plug-ins supporting it — and dates that statement “as of June 2008”, which tells you how long ago that page was last revised.
The second, repeated on several of the provider pages for feeds that do not support mixed mode, is blunter: run two databases, one end-of-day and one intraday, in two AmiBroker instances if you need both open at once. The same advice appears in the author’s guidance about bar counts — keep a separate database for real-time trading and another for long-history analysis, rather than one enormous real-time database.
This is not a workaround. It is the correct architecture, and it follows directly from the first half of this lesson. The two databases answer different questions, need different grains and need different bar counts. A database is cheap: it is a folder. Your history is not.
A workable split for most readers:
- A long-history end-of-day database. Base interval end-of-day, a large universe, years of bars. This is where Parts 12 to 16 and 28 to 35 live.
- A short-history intraday database. Base interval 1-minute, a small, deliberately chosen watch list, weeks or months of bars. This is where Parts 20 to 26 live.
If you have no live feed
Section titled “If you have no live feed”Nothing above depends on a subscription. The base interval of a local
database — one whose Data source is (local), fed by imported files rather than
a plug-in — behaves identically: it sets the grain, it enables every interval at
or above itself, and it cannot be un-compressed either.
So the Level A route through this part is:
- Create a local database with base interval 1-minute (or 5-minute if your files are five-minute bars — importing one-minute-grained data into a five-minute database is not possible, but importing five-minute bars into a one-minute database is fine, since five-minute bars are simply bars stamped five minutes apart).
- Import historical intraday files for a handful of symbols. The lab at the end of this part gives the exact import definition.
- Use Bar Replay to move through those bars as if they were arriving live. Bar Replay truncates the whole database at a playback position, so a formula sees only bars up to that point — which is what a live feed does, without the feed.
You will not have streaming quotes, and Parts 22 and 23 will tell you honestly where that matters. You will have a real intraday database, at a grain you chose, with all of the storage arithmetic and every maintenance problem that a paid database has.
The base interval is the grain: the finest bar the database physically stores. Every coarser interval is compressed from it on demand, which is free; the reverse operation does not exist, because compression discards the information that would be needed to invert it. The control is not disabled after creation, but changing it does not retroactively refine stored bars, so in practice the decision is permanent and the real remedy is a second database.
Choose the grain from the finest measurement your rules make, constrained by what your edition allows — tick and second intervals are Professional — and by what your source can deliver. Then size the bar count from arithmetic: 390 bars per regular session at one minute, 40 bytes per bar, and a dialog that will tell you the days-equivalent if you read it.
The next lesson goes through the Database Settings and Intraday Settings dialogs control by control, including the several controls that do nothing whatsoever in a local database.
Check your understanding
Sources for this lesson
6 verified · checked 2026-08-31
- 01AmiBroker User's Guide — Database Settings windowamibroker.com/guide/w_dbsettings.html2026-08-31
- 02AmiBroker User's Guide — Charting§ Intervals and periodicityamibroker.com/guide/h_charting.html2026-08-31
- 03AmiBroker User's Guide — Performance tuning tipsamibroker.com/guide/x_performance.html2026-08-31
- 04AmiBroker User's Guide — How to set up AmiBroker with IQFeedamibroker.com/guide/h_iqfeed.html2026-08-31
- 05AmiBroker User's Guide — How to use AmiBroker with myTrackamibroker.com/guide/h_mytrack.html2026-08-31
- 06AmiBroker — Order page, edition comparisonamibroker.com/order.html2026-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.