Skip to content

Appendix: Interactive Brokers

Interactive Brokers is a broker that also redistributes market data to its clients. That single fact explains almost every characteristic of the AmiBroker integration: the data is generous where a broker needs it to be — live quotes on the instruments you can trade — and severely constrained where a broker has no commercial reason to invest, which is historical backfill.

AmiBroker’s own documentation is unusually direct about this. It sets out the per-request ceilings, the throttle, the one-request-at-a-time rule, and then recommends a dedicated market-data vendor instead if fast backfills matter to you. This appendix records what those pages state, and marks the places where they are visibly old or silent.

Four things, all of them non-negotiable.

  1. An Interactive Brokers account, with the market-data subscriptions for the instruments and exchanges you want. Data entitlement at IB is separate from the ability to trade an instrument.
  2. Trader Workstation (TWS) installed and running, in either the standalone or the web-based form. The plugin does not connect to IB’s servers; it connects to TWS on your machine, and TWS connects to IB.
  3. AmiBroker with the IB plugin present. It ships with the program.
  4. A database created with the IB plugin as its data source. This is a create-time decision, as it is for every plugin.

Where the IB plugin sits

  1. ExchangesWhere the prints happenentitlements are set here
  2. Interactive BrokersConsolidates and redistributes to its own clientsyour subscription
  3. Trader WorkstationA Java application running on your machinemust be running
  4. AmiBroker IB data plug-inTalks to TWS over a local socket
  5. AmiBroker databaseLocal data storage enabled, base interval fixed at creation
  6. Charts, Analysis, alertsWhat you build
Two pieces of software you did not write sit between the exchange and your formula. Both are places a failure can originate.

Two settings inside TWS, both under Configure -> API:

  • Enable ActiveX and Socket clients must be turned on. Without it the plugin cannot connect at all, and the AmiBroker status light will sit on red.
  • Trusted IP addresses should include 127.0.0.1. This is optional in the sense that the connection works without it, but TWS will pop up an “Allow incoming connection?” dialog that has to be answered by hand each time.

Two practical points that the official page makes in period language but which still hold. TWS is the heavyweight component — a Java application that wants real memory and real CPU — so a machine that struggles is usually struggling with TWS rather than with AmiBroker. And TWS must be running before the plugin tries to connect; starting them the other way round produces a red status light and a confused user.

The documented one-time setup, from File -> New database:

Setting Documented value
Data source Interactive Brokers(R) data Plug-in
Local data storage Enable
Number of bars to load 30000 or more
Base time interval End-of-day, hourly, 15-minute, 5-minute or 1-minute

The Professional edition additionally offers tick, 5-second and 15-second base intervals. Configure opens the plugin’s own dialog, which exposes the backfill request length and whether automatic backfill happens on first data access.

Once the database exists, the plugin’s controls live in the plugin status area at the lower right of the main window. Right-clicking it gives the standard real-time menu — Reconnect, Shutdown, Force backfill — plus four entries specific to this plugin: Backfill Current, Backfill All RT quote window symbols, Backfill length, and Cancel Backfill.

AmiBroker symbols for IB follow the form SYMBOL-EXCHANGE-TYPE-CURRENCY, and only the first field is required.

  • SYMBOL — as TWS displays it in symbol mode, not underlying mode.
  • EXCHANGE — optional; for stocks it defaults to SMART/BEST routing.
  • TYPE — optional, defaults to STK for stocks. Documented long forms are STK, FUT, FOP, OPT, IND and CASH, with CMDTY and CFD appearing in the page’s examples. Single-letter forms — S, F, P, O, I, C — were added in plugin 1.8.2 so that non-USD instruments still fit inside AmiBroker’s symbol-length ceiling.
  • CURRENCY — optional since plugin 1.8.1, defaulting to USD for the equity-like types and to empty for CASH. So MSFT resolves internally to MSFT-SMART-STK-USD.

Documented examples include CSCO, VOD-LSE, ESM4-GLOBEX-FUT, INDU-NYSE-IND, XAUUSD-SMART-CMDTY and EUR.USD-IDEALPRO-CASH.

One more symbology point that matters for anyone charting currencies: IB sends no last-trade price for forex, so the plugin uses the bid. Since plugin 1.4.3 the default for forex backfill is MIDPRICE, switchable back to BID in the configuration screen. A forex chart from this feed is therefore not a trade series, and comparing it bar-for-bar against another vendor’s forex series will show differences that are not errors.

This is the section to read before choosing IB for research rather than for execution. Every figure below is stated on AmiBroker’s IB pages.

Constraint Documented value
Maximum 1-minute backfill 30 days (an experimental, slow 180 days is mentioned on ib.html)
Maximum bars at 1-, 5- and 15-second intervals 2000 bars
TWS ceiling, 1-second data 2000 ticks per request
TWS ceiling, 5-second data 10000 seconds per request
TWS ceiling, 15-second data 30000 seconds per request
TWS ceiling, 1-minute data 5 days per request; longer ranges are split into 5-day chunks fetched in sequence
Concurrency One backfill at a time. With automatic backfill on, a request for another symbol is ignored while one is running
Request throttle No more than 60 requests in 5 minutes
Finest backfill resolution offered 1-second bars, even if your database base interval is tick
Demo accounts No backfill at all — a TWS limitation

The throttle is the figure that shapes everything. AmiBroker translates it into a sentence worth committing to memory: sixty requests per five minutes works out at about one month of one-minute data for twelve symbols. That is the practical ceiling on how fast you can populate a database from this feed, and no setting changes it.

The mass-backfill procedure is different here

Section titled “The mass-backfill procedure is different here”

The Analysis-window trick — write Buy = 1;, apply to all symbols, one recent bar, tick Wait for backfill, press Scan — is documented for eSignal and IQFeed. The Knowledge Base places Interactive Brokers in a different class: limited backfill, one symbol at a time.

The documented IB procedure instead is:

  1. Add the symbols to the Real-Time Quote window (Window -> Realtime Quote).
  2. Right-click the plugin status area and pick a Backfill length — the shortest that meets your need.
  3. Choose Backfill All RT quote window symbols.

It runs sequentially. Cancel Backfill stops it. Because the Real-Time Quote window cannot hold more symbols than your subscription allows, this procedure is inherently bounded by the symbol limit as well as by the throttle.

100 streaming symbols, which is the TWS limit rather than an AmiBroker one. AmiBroker’s real-time symbol-limit guidance applies on top of that: set the plugin’s symbol count to match your entitlement, and do not run continuous scans over a universe far larger than the limit. The rotation mechanism that swaps older symbols out for newer ones exists, but leaning on it forces a backfill and a fresh stream for every displaced symbol — against a feed that already permits only one backfill at a time.

For a broker feed this limit is usually the right size for what the feed is for: watching instruments you hold or are about to trade. It is the wrong size for scanning a market.

  • Market data at IB is a separate subscription from the trading permission. Being able to trade an instrument does not entitle you to stream its data.
  • Backfill data for some symbols may simply not exist at IB. The official page says so plainly; it is not a fault you can configure away.
  • Demo accounts stream but do not backfill. If you are evaluating the integration on a demo login, the absence of history is expected behaviour, not a broken setup.
  • Professional or non-professional status affects exchange fees, as it does with every redistributor. That determination is made by IB and the exchanges, not by AmiBroker.

Prices are deliberately not quoted here. AmiBroker’s data-sources page carries a cost description for IB data, but that page states it is current as of March 2023 and warns on its own face that vendor offerings change often.

Verified from official AmiBroker pages, retrieved 31 August 2026: the requirement for TWS and the two TWS API settings; the Database Settings values; the base intervals and the Professional-only tick and second intervals; the symbology format and its examples; every backfill figure in the table above; the 100-symbol streaming limit; the plugin status menu entries; the statement that streaming from TWS consists of 0.2–0.3 second snapshots rather than every print; and the compatibility chart entry showing IB working in both the 32-bit and 64-bit builds.

Not verified, and stated as such:

  • Which version of the IB plugin ships with AmiBroker 7.00.1. The version history on ib.html stops at 2.0.4, dated 12 July 2010, and no page I could check states what is bundled with the current release. Read it from Tools -> Plugins on your own machine; that is the documented way to establish it.
  • Whether the experimental 180-day one-minute backfill still functions. It is mentioned once, described as slow, and not documented further.
  • Interactive Brokers’ current market-data subscription structure, its exchange fees, and its professional/non-professional determination. None of this is AmiBroker’s to document, and the figures on AmiBroker’s pages predate several rounds of change at IB.
  • The current TWS API behaviour. The AmiBroker page’s TWS version advice names builds from an era when hardware was measured in hundreds of megahertz. The underlying constraints — enable the API, one backfill at a time, a request throttle — are structural and have persisted; the specific build numbers are not usable.

Automated execution: where this course stops

Section titled “Automated execution: where this course stops”

AmiBroker ships a separate application, IBController (BrokerIB.EXE), that places, modifies and cancels orders at TWS. AFL reaches it through GetTradingInterface("IB"), which returns an OLE automation object, and which launches the application automatically on first call.

This course does not teach automated live order execution. It ends, deliberately, at alert → human review → decision, and Parts 21 and 22 build that chain properly. Three facts about IBController are worth knowing anyway, because they explain why the line is drawn where it is:

  • It is permanently labelled BETA, and its own documentation explains why: IB changes TWS and its API without notice, so fixes can only be made after something has already broken.
  • Repeated formula execution places repeated orders. Its documentation warns that running order code from an indicator means every chart refresh that satisfies the condition fires another order. This is not a hypothetical.
  • By default it does not transmit orders at all; transmission has to be deliberately unlocked. Its own readme tells you to test against the TWS demo, then a paper-trading account, and not to leave automated trading unattended.

If you go further with it later, that is your decision to make with full knowledge of the risk. It is not a step this course will walk you through.

Nothing above requires you to open an account, and everything this appendix teaches has a free equivalent.

To learn the plugin-fed database model without any feed: create a second database with the data source left as (local), populate it with free end-of-day data as the last lesson of this part describes, and compare its File -> Database Settings dialog with the table above. The dialog is the same dialog; the difference is which controls do anything. Number of bars to load, for instance, is documented as having no effect at all on a local database — a useful thing to see for yourself.

To learn the backfill-limit problem without hitting one: run the data requirements audit over a free end-of-day database, note the Days column, then imagine that column reading 30 instead of 5000. Every conclusion you could draw from the shorter history is one you would have to defend.

To learn the streaming workflow without streaming: use Tools -> Bar Replay on an end-of-day or historical intraday database. Playback affects every symbol at once, every chart and every Analysis run sees only data up to the playback position, and nothing is written to disk. GetPlaybackDateTime() returns the playback position, or zero when replay is not active, so a formula can tell which mode it is in.

To learn IB symbology without a connection: it is a string format. Write the symbols for a London-listed ordinary share, a GLOBEX future and a EUR/USD spot pair from the rules above, then check them against the documented examples. Getting the type and currency suffixes right on paper is the part that actually causes trouble later.

Check your understanding

Question 1. AmiBroker documents that TWS accepts no more than 60 backfill requests in 5 minutes. What does its own documentation say that works out to?
Show the answer and why

Answer: About one month of 1-minute data for 12 symbols

The throttle interacts with the 5-day-per-request ceiling on 1-minute data: a month needs several sequential requests per symbol. This is the number that decides whether IB can populate a research database at all.

Question 2. You add ESM4-GLOBEX-FUT and it works. You then add a symbol copied by hand from an ECBOT example and get "invalid symbol". What should you check first?
Show the answer and why

Answer: The number of spaces between the contract symbol, the month and the year

The documented ECBOT format uses three spaces between symbol and month and one between month and year. Whitespace errors are invisible on screen and produce exactly this message, which is why the official examples must be copied rather than retyped.

Question 3. Which of these are documented behaviours of the IB integration? Select all that apply.
Show the answer and why

Answer: Only one backfill can run at a time, Demo accounts receive no backfill, The finest backfill resolution offered is 1-second bars

The mass-backfill route for IB is the Real-Time Quote window plus "Backfill All RT quote window symbols" from the plugin status menu. "Wait for backfill" is documented for eSignal, myTrack and IQFeed, and the Knowledge Base puts IB in a separate, limited class.

Question 4. True or false: IB streaming data delivers every individual print, so a tick base interval reconstructs the full tape.
Show the answer and why

Answer: False

False. The official page describes TWS streaming as 0.2–0.3 second snapshots, and AmiBroker therefore recommends 5-second, 15-second or preferably 1-minute base intervals for this feed. A tick database cannot store detail the feed never sent.

Sources for this lesson

8 verified · checked 2026-08-31

  1. 01AmiBroker User's Guide — How to use AmiBroker with Interactive Brokersamibroker.com/guide/h_ib.html2026-08-31
  2. 02AmiBroker — Interactive Brokers data plug-inamibroker.com/ib.html2026-08-31
  3. 03AmiBroker User's Guide — How to get quotes from various markets§ Real-time data tableamibroker.com/guide/h_quotes.html2026-08-31
  4. 04AmiBroker User's Guide — How to work with Real-Time data pluginsamibroker.com/guide/h_rtsource.html2026-08-31
  5. 05AmiBroker User's Guide — 32-bit and 64-bit compatibilityamibroker.com/guide/compat.html2026-08-31
  6. 06AmiBroker Knowledge Base — How to backfill all symbols in RT databaseamibroker.com/kb/2014/09/23/how-to-backfill-all-symbols-in-rt-database2026-08-31
  7. 07AmiBroker — IBController readmeamibroker.com/at2026-08-31
  8. 08AFL Function Reference — GetTradingInterfaceamibroker.com/guide/afl/gettradinginterface.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.