# Settings: Connection

> Every option on Scalpel's Connection tab: the IBKR host and port, the IBKR scanner's filters and data recording, with defaults and when to change them.

Source: https://scalpeltrade.com/guides/settings-connection
Guide 11.1, Settings reference. Intermediate, 8 min read.
Checked with Scalpel 1.12.8 on 2026-10-15. By Scalpel Team.

**In short:**

The Connection tab decides how Scalpel reaches Interactive Brokers: **Host** `127.0.0.1` and **Port** `7497` by default, which must match the API socket port in TWS or IB Gateway. It also holds the IBKR scanner's switch and filters (by default $0.10 to $100, up 10% or more, 30 names, stocks only) and **Data recording**, which is off by default. Click **Apply** and the changes take effect at once, with no restart.

Open **Settings** from the header (or press `Ctrl`+`,`, `Cmd`+`,` on a Mac). Connection is the first tab. It has three blocks: the link to TWS or IB Gateway (1), the IBKR scanner that feeds every scan panel (2), and the market-data recorder (3).

*Screenshot: The Connection tab at its defaults: the TWS link (1), the IBKR scanner and its filters (2), and Data recording, switched off (3).*

## IBKR TWS (stocks: market data + orders)

Scalpel has no data feed or order route of its own. Everything, from the Level 2 book to your fills, goes through the API socket that TWS or IB Gateway opens on your computer. These three settings point Scalpel at it.

| Option | What it does for your trading | Default | Allowed values | When to change it |
|---|---|---|---|---|
| **Enabled** | Turns the link on or off. Off parks the connection: Scalpel stops retrying, the status bar's **IBKR** pill reads **Off**, and the connection banner is hidden. No data, no orders. | On | On or off | Turn it off when you run Scalpel without TWS on purpose (reviewing Analytics in the evening), so it stops trying to connect. Clicking the IBKR pill in the status bar does the same. |
| **Host** | The computer TWS or IB Gateway runs on. | `127.0.0.1` | An IP address or host name | Almost never. Keep `127.0.0.1` rather than `localhost`: TWS does not accept the IPv6 address `localhost` can resolve to. |
| **Port** | The API socket port Scalpel connects to. It must be the same number as in TWS (**Configure > API > Settings > Socket port**) or IB Gateway. | `7497` | 1 to 65535 | When TWS or IB Gateway uses another port. A blank or 0 port greys out **Apply** until you fix it. |

The settings note reads: "Scalpel starts on 7497 for TWS and 4001 for IB Gateway. Host/port changes reconnect on Apply (no restart)." When you change the host or port and click **Apply**, a **Reconnecting to IB** toast appears and the link drops and comes back on the new address. Positions and app-monitored stops stay as they are.

### Which port to use

Interactive Brokers' programs each suggest a different socket port, depending on the program and on whether you log in to your live or paper account:

| Program | Live login | Paper login |
|---|---|---|
| TWS | 7496 | 7497 |
| IB Gateway | 4001 | 4002 |

Whatever the program shows in its API settings is the number to type here. You do not need IBKR's paper login to practise: Scalpel's own [SIM mode](https://scalpeltrade.com/guides/paper-trading-sim) is a paper account that fills against the live book.

**Tip.**

You rarely need to type a port at all. While the link is down, a banner under the header checks TWS on 7497 and 7496 and IB Gateway on 4001 and 4002, says which one is running, and offers **Use port N** or **Use** the other program in one click. A program on any other port is not detected: type that port here. See [guide 1.4](https://scalpeltrade.com/guides/connect-interactive-brokers).

## IBKR scanner (market scans over TWS)

This is the list every scan panel works from. There is no separate scanner service to pay for: it runs on the Interactive Brokers market data you already have. It runs Interactive Brokers' own market scanner on your TWS connection: top gainers, 3 minute volume spikes, halts, hot by volume and gappers, merged into one list, pre-market included. IBKR refreshes the scans about every 30 seconds; the prices, change and ranking on the panel are live, tick by tick. If you switch it off, every scan panel says "IBKR scanner is off".

| Option | What it does for your trading | Default | Allowed values | When to change it |
|---|---|---|---|---|
| **Enabled** | Runs the scanner. Turning it on also turns on the scan engine, so the panels come alive. | On | On or off | Off only if you never use scan desks and want the market-data lines for something else. |
| **Price min** | The cheapest stock the list keeps, in dollars. | `0.1` ($0.10) | 0 or more, decimals allowed | Raise it to `1` or `2` to drop sub-dollar names if you do not trade them. |
| **Price max** | The most expensive stock the list keeps. | `100` ($100) | At least Price min (a lower number is raised to it) | Lower it to `20` for a classic small-cap momentum band. |
| **Min change %** | How far a stock must be up on the day, against yesterday's close, pre-market included. The scans are long only, so this is always "up at least". | `10` | 0 or more, decimals allowed | Raise it (20 or 30) on busy days to see only the strongest movers; lower it on quiet days. |
| **Min volume** | Shares traded today, pre-market included. Drops names that show a big move on a few hundred shares. | Empty (no limit) | A whole number of shares, or empty for no limit | Set `100000` or more if thin, untradeable names keep crowding the list. |
| **List size** | The most names the list holds. Each name uses one IBKR market-data line. | `30` | 1 to 100 | Lower it if you run short of market-data lines (desks need them too); raise it on a wide-open morning. |
| **Max shares out (M)** | A cap on shares outstanding, in millions. IBKR does not allow float as a scan filter, so this is the closest stand-in. | Empty (no limit) | Millions, decimals allowed (`7.5` is 7.5 million), or empty | Leave it empty unless you need it: names IBKR has no share count for are dropped, and those are often the fresh small caps that run. |
| **Stocks only (no ETFs)** | Leaves out ETFs, so a leveraged single-stock fund does not double up its underlying on the list. ADRs stay in, since many small-cap runners are ADRs. | On | On or off | Turn it off only if you trade ETFs. |

Scanner changes apply live: the next refresh uses the new filters.

**Note.**

Intel (borrow, dilution, catalysts) follows at most 40 symbols in all: the ones you hold first, then your desks, then the scanner's list. With a long list, the names at the bottom get no intel chips. See [guide 9.1](https://scalpeltrade.com/guides/set-up-intel).

### A worked filter

A small-cap momentum trader who only wants $1 to $20 stocks that are up 20% on real volume would set **Price min** `1`, **Price max** `20`, **Min change %** `20`, **Min volume** `200000` and leave **List size** at `30`. The list then holds at most 30 names and uses 30 market-data lines. Interactive Brokers accounts usually start with 100 lines, so that leaves room for your desks. Setting the filters up step by step is in [guide 8.1](https://scalpeltrade.com/guides/set-up-ibkr-scanner).

## Data recording (sessions saved to disk)

| Option | What it does for your trading | Default | Allowed values | When to change it |
|---|---|---|---|---|
| **Enabled** | Writes every session's market data, scans and fills to the `recordings` folder for the replay tools, plus a liquidity log, and opens up to twelve extra TWS connections to capture the IBKR scanner's list. | Off | On or off | Leave it off. It uses disk space (tens of megabytes a day) and TWS connections most traders never need. It does not change anything about your trading. |

It applies live, with no restart. A new file starts each UTC day.

## Applying changes

- Click **Apply** or press `Enter` to save and put the changes into effect: a new host or port reconnects at once, and scanner filters apply live. **Cancel**, the close button or `Esc` throws them away.
- A number field you leave empty keeps its previous value, except **Min volume** and **Max shares out (M)**, where empty means no limit.

## What can go wrong

- **The IBKR pill says Disconnected.** TWS or IB Gateway is not running, its API is off, or the port here does not match. The banner under the header says which. See [Scalpel says Disconnected](https://scalpeltrade.com/guides/fix-disconnected) and [TWS is running but not accepting the connection](https://scalpeltrade.com/guides/fix-not-accepting-connection).
- **Every scan panel says the scanner is off or waiting.** The scanner is switched off here, or TWS is not connected yet. See [guide 13: scanner off](https://scalpeltrade.com/guides/fix-scanner-off).
- **The scanner shows "No matches".** Nothing passes your filters right now. Lower **Min change %** or **Min volume**, or clear **Max shares out (M)**.

## Questions

**What port should Scalpel use for TWS?**

The one in TWS under Configure > API > Settings > Socket port. TWS suggests 7496 for a live login and 7497 for a paper login; IB Gateway suggests 4001 and 4002. Scalpel starts on 7497, and the banner offers to switch when it finds TWS or IB Gateway on one of the others.

**Do I need to restart Scalpel after changing the port?**

No. Click Apply and Scalpel reconnects to the new host and port at once, with a Reconnecting to IB toast.

**Why does the scanner have no float filter?**

Interactive Brokers does not allow float as an API scan filter. Max shares out (M) is the closest cap. Shares outstanding is never below the float, so a small number is a sure low float.

**Does data recording send my data anywhere?**

No. It writes files to the recordings folder on your own computer, for the replay tools. It is off by default.

**How many symbols can the IBKR scanner list hold?**

Up to 100, set by List size (30 by default). Each name uses one of your IBKR market-data lines.
