Interactive Brokers TWS Gateway automation comes down to one thing: a logged-in TWS or IB Gateway session that stays alive on a machine you control. PickMyTrade, a TradingView-to-broker trade automation platform, sends the orders, but it can only send them into a session that’s open. Most of the setup below exists to keep that session open all week.
Table of Contents
- How Does Interactive Brokers TWS Gateway Automation Work?
- What Do You Need Before You Install Anything?
- TWS or IB Gateway: Which Should Run Your Automation?
- How Do You Set Up the API Settings in TWS?
- Why Does Auto Restart Decide Whether Alerts Fire Overnight?
- Set Auto Restart, Not Auto Log Off
- Pick a Restart Time Outside IBKR’s Reset Window
- Handle the Weekly Login
- Where Should the Session Run, and Which IB Server Region?
- How to Connect PickMyTrade to TWS or IB Gateway
- How Do You Test the Whole Chain on a Paper Account?
- What Should You Check Every Week?
- What to Do When Alerts Stop Reaching IBKR
- Frequently asked questions
- The short version
You’ll install the software, switch on the API, pick a restart time, connect PickMyTrade and test on paper. A first run takes well under an hour. The parts that bite later are the daily restart and the weekly login, so those get their own sections.
Key Takeaways
- PickMyTrade reaches IBKR through TWS or IB Gateway, and both need a person to log in.
- Turn on the socket API, untick Read-Only API and match the port: 7496 or 7497 for TWS, 4001 or 4002 for Gateway.
- Set Auto restart outside IBKR’s 00:15 to 01:45 ET reset window, then log in by hand once a week.
- Give the automation its own IBKR username, and test on paper for two nights first.
Editorial note: PickMyTrade isn’t affiliated with Interactive Brokers. We analyzed IBKR’s guides and status page and PickMyTrade’s docs and app on September 30, 2026. We haven’t re-run a live TWS session for this update, so treat menu wording as the thing to confirm on screen.
How Does Interactive Brokers TWS Gateway Automation Work?
Your TradingView alert never reaches IBKR directly. It goes to PickMyTrade’s cloud, then to the PickMyTrade IB application on your machine, then into TWS or IB Gateway over a local socket, and only then to Interactive Brokers.
Two of those hops live on your side, which is why the setup is different from a cloud-only broker. PickMyTrade’s IB setup doc puts it in one line: it connects through TWS, not directly to IB’s servers, and TWS must stay open and logged in during trading hours.
Trader Workstation (TWS) is IBKR’s full desktop trading platform, with charts, order tickets and the API built in. IB Gateway is the stripped-down version that only logs in and serves the API. Both are Java programs, and IBKR’s older API guide says neither one supports headless operation, because the login needs a window and a person.
That last fact changes the job. You aren’t installing a service. You’re babysitting a desktop session, and the guide is really about making it need babysitting once a week instead of once a day.
What Do You Need Before You Install Anything?
Five things need to be in place first, and two of them catch people. IBKR’s API requirements page asks for a funded IBKR Pro account, so IBKR Lite is out. It also lists which two-factor methods the API accepts, and one popular method, the printed Security Code Card, isn’t on it.
- An IBKR Pro account, live or paper, with the futures or stock permissions you plan to trade.
- A supported two-factor method: IB Key, Handy Key, SMS or Digital Security Card+. The Security Code Card (“bingo card”) isn’t supported for API logins.
- A second username for the automation session, covered below.
- A paid TradingView plan with two-factor sign-in, since the free Basic plan can’t send webhooks.
- A PickMyTrade account. The free trial runs 7 days with no card.
Why a second username? IBKR’s API guide says one username can’t log in to two trading applications at once. It adds that a TWS session whose username also opens Client Portal can’t reconnect on its own after the next server reset.
So the login you use to check your balance in a browser can quietly break the automation overnight. Create a separate username in Account Management, then subscribe to market data on it, because IBKR sets data subscriptions per live username.
A paper account has its own quirk. IBKR says all paper accounts connect to the US server and that a paper session gets no market data if it shares data from a live user who also logs in to Client Portal. If your paper chart is blank, look there first, and our IBKR paper trading guide covers opening the account.
TWS or IB Gateway: Which Should Run Your Automation?
Run TWS first, on a paper account, and move to IB Gateway only if you have a reason. PickMyTrade’s IB setup doc is written around TWS, its tutorial videos show TWS, and its broker page says TWS or IB Gateway both work. IB Gateway is lighter, but you’d be leaving the documented path.
| TWS | IB Gateway | |
|---|---|---|
| Live port | 7496 | 4001 |
| Paper port | 7497 | 4002 |
| API on by default | No | Yes |
| Footprint | Full platform | About 40% lighter |
| Updates | Self-updating or offline | Offline only |
| Charts and tickets | Yes | No |
The 40% figure comes from IBKR’s older API guide, which is marked deprecated, so read it as a rough size rather than a spec. Two other rows matter more than they look.
“API on by default” means a fresh TWS refuses socket connections until you tick a box, while a fresh Gateway accepts them. And “Offline only” is a clue about restarts: IBKR’s auto-restart page says the feature works best with offline versions, because a failed automatic update can interrupt the restart. Installing the offline TWS build, not the self-updating one, removes that failure.
Don’t run TWS and IB Gateway on the same machine at the same time. They invite connection conflicts, and each one wants its own port and its own login.
How Do You Set Up the API Settings in TWS?
Open Edit, then Global Configuration, then API, then Settings. In the Mosaic layout the first menu is File instead of Edit. Seven settings matter, spread across three screens.
- Tick Enable ActiveX and Socket Clients. TWS ships with it off, so nothing can connect until you do.
- Untick Read-Only API. IBKR turns it on by default, and with it on the connection succeeds but orders are refused.
- Read the Socket Port and write it down. Use 7496 for a live TWS session and 7497 for paper.
- Leave Allow connections from localhost only ticked when the PickMyTrade IB app runs on the same machine as TWS. Add a Trusted IP only if the app runs somewhere else.
- Leave Master API client ID blank. It only matters for one client that must see every other client’s orders.
- Under Precautions, tick Bypass Order Precautions for API orders. Otherwise IBKR can hold an order at “Untransmitted” waiting for a click nobody makes.
- Under General, set Memory Allocation to 4000 MB if the machine has the RAM. IBKR recommends that figure for API users.
Step 4 is where the guides disagree. One PickMyTrade page says to add your trusted IP, while a VPS partner’s guide says to untick localhost-only and add the VPS address, even though the app runs on that same VPS.
IBKR built the localhost setting for the same-machine case. We’d start there and widen it only if the app reports a refused connection.
The precaution in step 6 has a whole doc of its own. Errors 354 and 163 on untransmitted orders trace back to it, and PickMyTrade’s order precaution fix says to check it on the installation that’s connected to the affected account. A new TWS profile or a reinstall resets it.
Step 7 is the one people skip. A 4,000 MB allocation on a machine with 4 GB of total memory starves Windows itself, so this is a reason to size the machine before you buy it, not after.
Why Does Auto Restart Decide Whether Alerts Fire Overnight?
Because both programs are built to shut down every day. IBKR’s older API guide says TWS and IB Gateway “were designed to be restarted daily” so they can reload contract definitions. If you never configure anything, the session ends at its auto log off time and stays ended.
Set Auto Restart, Not Auto Log Off
Open Global Configuration, then Lock and Exit. IBKR’s best-practice page for API users names two choices, Never lock Trader Workstation and Auto restart, so pick both. Auto restart relaunches the platform without asking for a password, which is the entire point.
Auto restart is the Lock and Exit option that closes and reopens TWS or IB Gateway every day at a time you choose, with no login prompt until IBKR’s weekly token expires. Accounts held at Interactive Brokers Hong Kong don’t get these two options in TWS, so IBKR suggests IB Gateway for them.
Pick a Restart Time Outside IBKR’s Reset Window
IBKR’s system status page lists a daily reset for North America from 00:15 to 01:45 ET, Sunday through Friday, and a longer one on Saturday from 00:00 to 02:00 ET. During a reset, the page says, there may be an interruption in the ability to log in or manage orders. A restart scheduled inside that window can land on a login that fails.
So set the restart somewhere else, at a moment you’re flat. For futures, the hour when CME equity index contracts pause, 5:00 to 6:00 pm ET, is the natural slot. We’d pick 5:30 pm.
Resting stop and limit orders live at IBKR, not in TWS, and the same status page says native order types keep operating through a reset. Simulated order types are delayed until it ends, so check which type your bracket uses before you trust it across a restart.
Handle the Weekly Login
Auto restart doesn’t remove the login. It moves it to once a week, the first time you sign in after IBKR invalidates the security tokens. Here’s the awkward part: IBKR’s own pages disagree about which day that is.
We analyzed four IBKR pages on September 30, 2026, and they don’t agree:
- Auto-restart page: the tokens expire each Sunday at 1:00 am ET, and the first login after that must be manual.
- API best-practice page: the weekly cycle starts on Monday.
- Older API guide: re-enter your credentials after the nightly server reset on Saturday night.
- Status page: a scheduled Saturday reset from 00:00 to 02:00 ET.
None of that can be reconciled from outside, so treat the safe rule as the answer. Log in by hand on Sunday before the futures session opens at 6:00 pm ET, and check the connection again before Monday’s first trade. If TWS ever refuses with “Soft token=0 received instead of expected permanent”, that’s IBKR asking for the manual login.
Three things break the daily restart itself, according to IBKR: a machine asleep or hibernating, a machine with no power at restart time, and an operating system update that reboots the computer. That’s why the next section is about the machine.
Where Should the Session Run, and Which IB Server Region?
Somewhere that never sleeps, never loses power and never reboots for updates at 2 a.m. A laptop with the lid closed fails all three tests. IBKR’s own list of what defeats auto restart (sleep, no power, OS updates) reads like a description of a home PC.
You have two realistic options. An always-on desktop works if you turn off sleep and hibernation and move Windows updates to a weekend window you’re awake for, and a VPS removes the power and network problems: PickMyTrade’s docs point to QuantVPS with TWS and the PickMyTrade app preinstalled. Neither removes the weekly login.

Size the machine from the memory figure above. If IBKR wants 4,000 MB for TWS, the operating system, the PickMyTrade app and a browser need room on top of it, so a 4 GB box is too small and 8 GB is a sensible floor. That’s our arithmetic, not a vendor spec.
Then check where your account connects. In TWS, open the Data window and read the Primary server, which looks like cdc1.ibllc.com.
Each account has a pre-assigned IB server, and IBKR says the maintenance schedule follows that server’s region, not your computer’s. Paper accounts always sit on the US server, and moving a live account means opening a Technical Assistance ticket.
Why does that matter? The reset window in this guide, 00:15 to 01:45 ET, is the North America one, and Europe’s runs 06:25 to 07:45 CET. Asia has two resets a day, so if your account isn’t on a North America server, pick your restart time from your own region’s row of the status page.
Last, protect the box. An always-on trading session is exposed to anyone who reaches the desktop, so IBKR recommends locking down the OS account and keeping IB Key two-factor on.
How to Connect PickMyTrade to TWS or IB Gateway
With TWS logged in and the API settings saved, the PickMyTrade side takes a few minutes. We analyzed the app’s public code and PickMyTrade’s IB setup doc, updated September 29, 2026, to check the steps.
- Log in to TWS with the automation username. Start on the paper account, and confirm the account number shows in the window.
- Create your PickMyTrade account and download the IB application from the dashboard. Run it on the same machine as TWS.
- Click IB Connection in the app’s navbar. If it asks for a port, enter the one you wrote down earlier.
- In the dashboard, open Generate Alert. Choose IB as the broker, pick Strategy or Indicator, then set the instrument type.
- Add your account. You’ll enter your IB Connection Name, and the connection table then shows the token, connection name, account number, risk percentage and quantity multiplier.
- Copy the alert code and the webhook URL into a TradingView alert. The app’s finish screen adds a third reminder for IB users: make sure your IB application is running.
- Wait for the first alert. Trades show up in the Alerts tab once one fires.
We analyzed the app’s public bundle on September 30, 2026 to confirm step 6. The IB-only reminder is in the code, which is a good sign that the desktop app is a required piece, not an optional extra.
The message you paste into TradingView is the part with the most options. Our TradingView alerts to TWS guide walks through the JSON, and the docs cover several IB accounts on one plan.
Plan on running the session yourself. The setup doc says PickMyTrade connects through TWS and names no hosted alternative. A broker page on the site mentions a cloud connection, but we found no setup steps for one, so this guide doesn’t depend on it.
How Do You Test the Whole Chain on a Paper Account?
Send one small alert on paper, then watch each link in turn. Why every link? A test that only checks the last one tells you nothing about the earlier ones.

| Check | Where | Good sign |
|---|---|---|
| Session | TWS window | Paper account logged in |
| Socket | PickMyTrade IB app | Shows connected |
| Alert | Alerts tab | A row for the test |
| Order | TWS Orders window | Order appears, then fills |
If the alert row shows but TWS is empty, the break is between the app and TWS: read-only mode, the port, or the precaution. If TWS shows an order stuck as Untransmitted, it’s the precaution from step 6. Futures add one more failure, a symbol that doesn’t map to an IBKR contract, which our symbol mapping guide covers.
Then run the part most tests skip: leave everything alone for two full nights. The test that matters is whether TWS is still logged in the next morning after its auto restart. A setup that passes at 2 p.m. and fails at 8 a.m. hasn’t passed.
Only move to live after that. Switching means a different TWS session, a different port and a different account number in PickMyTrade, so redo the port check rather than assuming.
What Should You Check Every Week?
Five minutes, on a fixed day. The routine is short because the setup did the heavy lifting, and it only has to catch the two failures that can’t be automated.
- Sunday before 6:00 pm ET: log in to TWS by hand and approve the IB Key prompt.
- Sunday, same sitting: confirm Lock and Exit still says Auto restart and Never lock.
- Monday before your first trade: check that TWS, the app and the dashboard all read connected.
- After any Windows, TWS or Gateway update: reopen the API and Precautions screens, because a new profile can reset them.
- Every month or so on IB Gateway: install a fresh offline build, since it doesn’t update itself.
If you keep one habit from this guide, make it the Monday check. The Sunday login is easy to forget, and a Monday-morning look is the cheapest way to catch a forgotten one before it costs a session.
What to Do When Alerts Stop Reaching IBKR
Start by asking which link broke, using the same four checks as the paper test. Most stalls are one of three: TWS logged out, the app closed, or a setting that reset. If the dashboard says disconnected but the app says connected, close the app and reopen it once TWS shows your account, because that recreates the socket.
| Symptom | Read this |
|---|---|
| Orders held as Untransmitted | Precaution fix |
| No security definition or mapping error | Symbol mapping guide |
| Costs of the API and data | IBKR API cost guide |
| Other brokers on the list | Broker connection guide |
If you’re weighing IBKR against a broker with no desktop session to keep alive, that last guide shows what each connection asks for. For contact details, the support page is the fastest route, and the about page explains who we are.
Ready to connect your own account? See how PickMyTrade routes TradingView alerts to Interactive Brokers and start the 7-day trial.
Frequently asked questions
Yes. PickMyTrade’s IB setup doc says it connects through TWS, not directly to IB’s servers, and that TWS must stay open and logged in during trading hours. The PickMyTrade IB application runs beside it on the same machine, and both have to be running when an alert fires.
No, and IBKR’s API guide says why: headless operation of TWS or IB Gateway isn’t supported, because the secure login needs a person at a window. Auto restart covers the daily restart, but the weekly login stays manual. A VPS or spare PC keeps the window open without tying up your own computer.
About once a week with Auto restart on. IBKR’s pages disagree on the day: one says Sunday at 1:00 am ET, another says the cycle starts Monday. The safe habit is a Sunday login before the 6:00 pm ET futures open, plus a Monday check.
Use a second one. IBKR allows one login per username, and a TWS session whose username also opens Client Portal can’t reconnect after the next server reset. Market data subscriptions are set per live username, so subscribe on the new one before you test.
Pick a time when you’re flat and outside IBKR’s North America reset, 00:15 to 01:45 ET. For futures, 5:30 pm ET falls in the CME break. If your account sits on a European or Asian server, use that region’s reset window instead.
The short version
Interactive Brokers TWS Gateway automation stays reliable when you treat it as one session with two chores. Set Auto restart once, outside the reset window. Then log in by hand on Sunday and check on Monday.
Everything else in this guide is a one-time setting: the socket, Read-Only API, the port and the precaution. Test all of it on paper for two nights first. If a link breaks later, the four checks in the test section tell you which one.
Disclaimer:
This content is for informational purposes only and does not constitute financial, investment, or trading advice. Trading and investing in financial markets involve risk, and it is possible to lose some or all of your capital. Always perform your own research and consult with a licensed financial advisor before making any trading decisions. The mention of any proprietary trading firms, brokers, does not constitute an endorsement or partnership. Ensure you understand all terms, conditions, and compliance requirements of the firms and platforms you use.
Also Checkout: OneUp Trader Rules: Payouts, Resets & TradingView Automation
Connect your alerts with PickMyTrade — automated trade execution, no coding required. Start free →
