Skip to content

GuidesBroker and TWS

7 min read

TWS hotkeys for scaling out without losing your stop

What Close Portion of Positions actually does to an attached stop in TWS, and the one-key alternative that never leaves a position unprotected.

An illustration, not a screenshot: what Close Portion of Positions leaves a stand-alone stop at, beside Degen Pro's one key. No position is drawn.

A drawing of scaling out of half a position two ways: in red, "Close Portion · stop still full size"; in green, "Degen Pro key · stop resized in the same action". The words over them read "One key. Stop stays."

The short answer

TWS hotkeys can close a position, close a percentage of one, or fire a bracket order, all from Global Configuration, and none of that touches a stop order already working on the rest of the position. That is not a bug anyone has filed, because it is not TWS's job to guess what you meant by the stop. It is yours to notice, and the fastest way to notice it is a fill confirmation and a position that is smaller than the stop was ever sized for. This is what the hotkey actually does, what it leaves for you to do by hand, and where a Stream Deck fits once the keys exist.

How do I set up hotkeys in TWS?

Hotkeys live in Global Configuration, reached from File in the top left of TWS. IBKR's own lesson on configuring them says hotkeys are created by picking a command from a list of possible actions and assigning "any keystroke, or a combination of the 'Ctrl' and 'Shift' keys with one of the 26 keyboard letters," and that they take effect immediately, with no restart needed.

How do I close part of a position in TWS with a hotkey?

For closing part of a position specifically, the action is Close Portion of Positions, and IBKR's documentation on closing positions confirms you set "the % amount of the position you would like to close." IBKR Desktop's newer hotkey system goes further and offers fixed choices: 25, 50, 75 or 100 percent.

Press the key, and TWS builds a market or limit order sized to that percentage. That part works exactly as advertised.

What happens to my stop when a hotkey sells part of my position?

For a stop you placed on its own, nothing — and that is the whole finding. It is worth stating plainly because IBKR's own documentation states it by omission: the Close All Positions and Close Portion of Positions pages describe percentages, filters and order types, and at no point mention an existing stop order on the position being closed. The hotkey does one thing, correctly. It does not cancel a stand-alone stop, and it does not resize it.

A stop that was attached to the entry as a bracket child is a different order, and it is reported to behave differently: traders describe a partial close through the hotkey deactivating the attached stop for the portion they kept, leaving it unprotected rather than over-protected. That is the opposite failure, and it has not been tested here. Until it has, treat the two cases as two cases: read the section below for a stand-alone stop, and for a bracket child check the stop in your order list the moment the partial fill confirms, every time. Every other way out of a position, and what each does to the stop, is on one page, each marked documented, reported or untested.

Work out what that means for a real position. You are long 300 shares with a stop-loss order resting for all 300. You press the hotkey mapped to Close Portion of Positions at 50%, it fills, and you are now long 150 shares. Your stop order is still an order to sell 300 shares. Depending on your account's settings that is either an order that will try to sell shares you no longer hold, or one that gets rejected outright, and either way the 150 you kept are not protected at the size you think they are. Nothing on screen tells you this happened; the fill confirmation for the sale looks identical whether or not the stop it left behind still makes sense.

The fix by hand is four steps done under time pressure: cancel the old stop, confirm the sale filled, work out the new quantity, and place a new stop at the price you meant. Every one of those is a place to make a mistake, and the market has not stopped moving while you do it.

Should I use instantaneous transmission for TWS hotkeys?

That is the other lever IBKR gives you, and it trades one risk for another. Its hot keys documentation is direct: "When you activate instantaneous transmission, using the hot key combination creates and transmits the order without giving you time to review and modify order parameters." Leave it off, and the same page says the hotkey "create[s] an order and leave[s] it on the trading screen for you to manually transmit."

Off is safer for anything you might get wrong, and useless for anything that has to happen before price moves again. On is fast and forgives nothing: a hotkey pressed by reflex, or a Stream Deck button hit in a hurry, transmits immediately with whatever quantity and price the mapping had. There is no setting that is both instant and reviewable. You are choosing which failure mode you would rather have.

Does a Stream Deck work with TWS?

Yes, mechanically. A Stream Deck is a set of programmable buttons, typically mapped to run a keystroke, which means anything you can bind to a TWS hotkey you can put on a Stream Deck button with a label and an icon instead of a key combination you have to remember under pressure. The trading write-ups for the Stream Deck that exist are written for other platforms; Bullish Bears' review of the device for trading names ThinkorSwim and TradeStation and does not mention Interactive Brokers, TWS, or what a partial close does to a resting stop. The hardware is platform-agnostic. The documentation for using it with TWS specifically, and for what it does to a stop when you press it, is not written anywhere IBKR or the review sites cover.

That gap is real for a mechanical reason, not a lazy one: a Stream Deck button is exactly as safe or as dangerous as the hotkey behind it, and nobody reviewing the device for TradeStation has a reason to know what TWS's Close Portion of Positions does to an IBKR bracket order.

An illustration, not a screenshot.

A drawing of the app's Hotkeys settings with "Using a Stream Deck or other macro pad" opened into five numbered steps: record a key, save, drag Hotkey onto a Stream Deck button, press the same combination in its Hotkey field and give the button a title such as PROTECT, FLATTEN or BUY 3, then press it once while flat. Under it, two of the deck lamp's promises: "lit only while every exit key would act and the helper answered" and "dark while Trader Workstation's API is Read-Only, which refuses what the deck sends".
The app's own Stream Deck steps, word for word. The lamp's promises under them are the app's words too, but they are not on this screen; setting them there is ours.

Where Degen Pro fits

Degen Pro is a Mac app for Interactive Brokers built around the gap this guide describes. Selling part of a position that has a stop attached means, in Trader Workstation, cancelling the stop, selling, working out what is left, and placing a new stop by hand while price moves; in Degen Pro it is one key, and the stop never comes down: PROTECT, peel a runner, flatten everything. Each does exactly one thing, the same way every time, and the app resizes or replaces the stop as part of the same action instead of leaving it for you to notice later. PROTECT sells a share you choose, half unless you change it, and once the trade is far enough ahead moves the stop on the rest to break-even or a margin above it that you set. The keys can sit on an Elgato Stream Deck, with a lamp that says whether the exit will actually work before you press it, which is the check TWS's own hotkeys do not run. It gives no signals — it can place an entry you choose, calls and puts on SPX and SPY, but it never tells you what to take; the keys need Interactive Brokers, on a Mac. They act through the TWS API, so the API settings that break, in order apply to them too, and what the app asks of Trader Workstation is on the setup page.

Before you map a hotkey to a partial close

  1. Know whether Close Portion of Positions is set to a percentage of the position or a fixed share count, and confirm which one you meant.
  2. Decide instantaneous transmission per hotkey, not once for all of them. A key that only ever does one safe thing is a better candidate for instant than one that could fire on the wrong symbol.
  3. After any partial close by hotkey, check the stop's quantity before you look away. TWS will not check it for you.
  4. If a Stream Deck button maps to a partial close, label it with the percentage and the fact that the stop needs a second look, because the button will not remind you either.

None of this is investment advice. Trading involves risk of loss, and a stop sized for a position you no longer hold protects less than you think it does.

Questions people ask

How do I close part of a position in TWS with a hotkey?

Assign the Close Portion of Positions action in Global Configuration and set a percentage. It builds a market or limit order for that percentage of your position. It does not touch a stand-alone stop order on the rest — which is its own problem, below.

What happens to my stop when a hotkey sells part of my position?

For a stop you placed on its own, nothing — TWS's own documentation for closing positions does not mention stop orders at all, so the stop stays sized for the full position and is now wrong for what is left. A stop attached as a bracket child is reported to behave differently and be deactivated for the kept portion instead; that case has not been tested here. Either way, nothing in TWS tells you.

Should I turn on instantaneous transmission for TWS hotkeys?

IBKR's documentation is direct about the trade-off: instantaneous transmission creates and transmits the order without giving you time to review it. Off, the hotkey builds the order and waits for you to send it, which is a second chance and a second delay.

Does a Stream Deck work with Interactive Brokers TWS?

Yes, through the same hotkeys Global Configuration creates, mapped to Stream Deck buttons instead of typed key combinations. Existing Stream Deck trading guides are written for ThinkorSwim and TradeStation and do not cover TWS or what happens to a stop.

Can a hotkey close a specific percentage of a position?

Yes. TWS's Close Portion of Positions action lets you set the percentage of the position to close, and IBKR Desktop's newer hotkeys offer fixed 25, 50, 75 and 100 percent options.

Sources

  1. IBKR Campus: Configuring TWS Hotkeys
  2. IBKR Guides: Hot Keys
  3. IBKR Guides: Close All Positions
  4. Bullish Bears, Stream Deck for Trading: Setup, Tools and Uses