> ## Documentation Index
> Fetch the complete documentation index at: https://docs.traderframe.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Interactive Brokers

> Trade stock index futures from your IBKR account through the TraderFrame Bridge.

TraderFrame connects to Interactive Brokers through a small program called the **Bridge** that runs beside your IB Gateway. Your IBKR login and two-factor stay on your computer. The Bridge holds one TraderFrame token, executes the orders your bots decide, and reports every fill back.

The venue is **stock index futures**: MES, MNQ, ES, NQ, YM and RTY on CME and CBOT. Single stocks and options are not part of it.

## Before you start

* An IBKR account. Start on **paper**; TraderFrame labels paper and live everywhere.
* **IB Gateway** or Trader Workstation installed and logged in on the machine that will run the Bridge. IBKR Desktop has no API and will not work.
* Linux only: Python 3.10 or newer. The Mac and Windows apps need nothing else.

## Connect

1. **Brokers → Add → Interactive Brokers**, choose Paper or Live. TraderFrame shows your **Bridge token**.
2. In Gateway: **Configure → Settings → API → Settings**. Tick *Enable ActiveX and Socket Clients*, untick *Read-Only API*, add `127.0.0.1` to Trusted IPs. Note the port: paper Gateway is 4002, live is 4001 (TWS: 7497 and 7496).
3. Download the TraderFrame Bridge: [for Mac](https://mmco.fsn1.your-objectstorage.com/mmco/ea/bridge/TraderFrame-Bridge-mac.zip) (unzip and open) or [for Windows](https://mmco.fsn1.your-objectstorage.com/mmco/ea/bridge/TraderFrame-Bridge-Setup.exe) (run the installer; on first launch Windows may say "unknown publisher", choose More info, then Run anyway). Linux: the [Python version](https://mmco.fsn1.your-objectstorage.com/mmco/ea/bridge/traderframe-bridge-latest.zip), unzip and double-click `start.command`.
4. Paste your Bridge token into the app and press **Connect**. It finds IB Gateway on its own, paper or live, and remembers the token.
5. Leave the app open. The account shows **Connected** within about 20 seconds, with the IBKR account id, net liquidation and buying power.

The token never changes unless you disconnect the account. **Brokers → ⋯ → View Bridge token** shows it again.

## Updating the Bridge

The current Bridge is **1.2.2**. The Brokers page shows the version your Bridge reported beside the account, and an **Update Bridge** link when a newer build is out. To update, download again from the links above and replace the app (Mac: drag the new app over the old one; Windows: run the installer). Your token and settings stay. On Linux, replace `bridge.py` with the one in the new zip and restart.

* 1.2.2: a bar stream frozen by Gateway's daily restart is detected and requested again, so candles and trade cards keep filling.
* 1.2.1: the close report carries the close commission, so a close by hand settles on the exact fill and fee.
* 1.2.0: fills and closes survive a Bridge restart; a report TraderFrame did not accept is retried.

## Daily re-login

IB Gateway asks you to log in again once a day, and to re-authenticate fully once a week. While it is logged out the account reads **Needs your login**, your futures bots pause, and stops already placed at IBKR stay in place. Log in and the Bridge reconnects on its own.

## Market data

Most accounts start with **delayed** data. On paper that is fine and the account shows a *Delayed* pill. On a live account, entries are refused until the Bridge reports real-time quotes. Real-time CME data is a subscription in your IBKR account, not a property of the account being live.

**Subscribe in one click:** [Market Data Subscriptions in IBKR Client Portal](https://www.interactivebrokers.com/sso/resolver?action=UserSettings\&config=MarketData) (Settings → Trading Platform → Market Data Subscriptions). Pick the CME real-time bundle. To get the same on a paper account, turn on sharing market data subscriptions with the paper account in the same settings. The close sheet's delayed banner carries the same link.

While the feed is delayed, everything the app and the Trade Agent see on this venue is 15 minutes old: quotes, floating estimates and the agent's bars. Fills still happen at the live price.

## The bot

* **Product**, not symbol. Pick MNQ and TraderFrame trades the front month, moving new entries to the next month three trading days before expiry. Open positions are never carried across a roll: the flatten time closes them. You can pin one contract month instead.
* **Contracts per signal** are whole contracts. Martingale steps are whole contracts too, rounded up.
* **Entry**: Market, Limit at the signal price, or **Bracket**, which sends the entry, stop and target to IBKR as one set so the stop lives at the exchange even if the Bridge goes offline. Bracket is the default.
* **Session**: regular hours (09:30 to 16:00 Eastern) or extended hours. Outside the chosen session the bot refuses entries.
* **Flatten at**: an exchange-time clock after which no new entries are taken and open positions are closed. On by default at 15:55; turn it off for swing bots.
* **Exit rule**: stop and target as a distance in ticks, points, ATR or dollars, plus an optional move to break-even. IBKR holds the levels; the engine only ever tightens them.
* Signals may name the product any way a chart does: `MNQ`, `MNQ1!`, `CME_MINI:MNQ1!` or `MNQZ6`. The contract month is TraderFrame's decision, never the signal's.

## What you see

Trades read in **points and dollars**: "MNQ Dec 2026 · Buy · 2 contracts · +23.75 pt · +\$95.00". Commissions are inside the net figure. The dashboard strip shows the Bridge state, net liquidation, margin in use and the next roll date.

## Closing by hand

**Close now** on the Trades tab sends a market order the other way through the Bridge and cancels the stop and target IBKR was holding. The record settles when the Bridge reports the fill. Outside CME hours, and during US holiday early closes (Labor Day, Thanksgiving and Christmas Eve, when equity index futures halt at 13:00 Eastern and reopen at 18:00), IBKR holds the order and fills it at the reopen, so the position stays open until then.

**Held at IBKR, not tracked.** If IBKR reports a position that no open trade here matches, the Trades tab lists it under this heading with a Close at market button. That happens when two close orders fill together and leave a position the other way, or when you place an order by hand. Close at market sends a market order the other way through the Bridge and records the result in the ledger like any trade. Nothing here is sent unless you press it.

## Refusals you may meet

* *Market closed for this bot* — the session rule. Switch to extended hours if you mean to trade the overnight session.
* *Not enough buying power* — the size needs more margin than the account has, with a 20% cushion.
* *Live entries need real-time data* — subscribe to CME real-time data in IBKR.
* *The Bridge is offline* or *IB Gateway needs your login* — start the Bridge, or log Gateway back in.

## Limits

* One Bridge per IBKR account, on one machine.
* Plain individual accounts only. Linked and advisor account structures are not supported.
* The Bridge places orders only for commands TraderFrame queued for this account. It never trades on its own.
