Send TradingView Alerts to Interactive Brokers TWS via Webhook

Trader Workstation has no webhook listener. There’s no URL you can paste into TradingView that TWS will ever answer directly, and that single fact is why more setup guides for this pairing get abandoned halfway through than for almost any other broker. Interactive Brokers built TWS around a local socket API, not an inbound HTTP endpoint, so “just paste the webhook URL” doesn’t work the way it does for cloud-native brokers. That doesn’t mean it can’t be done, though. It means something has to sit between TradingView and TWS, translating one protocol into the other, and this guide covers exactly how that bridge works: the specific TWS and IB Gateway settings that block orders when left on their defaults, the JSON payload that actually reaches your account, and what to check when an alert fires but nothing shows up in your order log.

The most common support ticket on this integration isn’t a bad webhook URL. It’s Read-Only API, a checkbox IBKR enables by default on every fresh TWS install, silently blocking every order the API tries to place. Nothing errors loudly. The order just never lands.

For the broader case on why IBKR needs a relay at all and how it compares to a DIY Python bridge, PickMyTrade’s 2026 IBKR automation guide covers that decision. This piece picks up where that one stops: the actual TWS configuration, port by port.

Key Takeaways

  • TWS and IB Gateway have no native webhook listener. PickMyTrade bridges TradingView’s webhook to your TWS/Gateway session over the local socket API instead.
  • Read-Only API is enabled by default in TWS and blocks every order placed through the API until you turn it off in Global Configuration.
  • IBKR now has roughly 5.19 million funded accounts, up 34% year-over-year, and PickMyTrade’s cloud-hosted Gateway option removes the “keep TWS open” requirement for traders who don’t want a machine running around the clock.

The Checklist Before You Start

Five things, and the one that trips up more people than the rest combined is TWS itself. You need a funded or paper IBKR account, TWS or IB Gateway installed, a paid TradingView plan, a PickMyTrade account, and roughly 20 minutes. Budget more like 30 if this is your first time inside TWS’s configuration menus.

Your checklist:

RequirementDetailWhy it matters
IBKR accountLive or paper (DU-prefixed IDs)The destination for every order
TWS or IB GatewayInstalled and logged inPickMyTrade connects through this, not directly to IBKR
TradingView planEssential, Plus, Premium, or UltimateWebhook alerts are paid-tier only
PickMyTrade accountFree trial or paid subscriptionTranslates the webhook into a TWS API order
Time~20-30 minutesMost of it is one-time API configuration
DifficultyIntermediateOne extra layer versus a cloud-native broker
A laptop and desktop computer set up on a white desk, representing the workspace used to configure TWS and connect a PickMyTrade account.

Every paid TradingView tier includes webhook notifications, so Essential at roughly $14.95/month is enough to run this setup. What changes across tiers is how many alerts you can keep active at once, not whether webhooks work at all.

Why Doesn’t TradingView Just Connect to IBKR Directly?

Because TWS was built as a desktop trading terminal with an API bolted on for algorithmic access, not as a cloud service waiting for inbound requests. The TWS API, also called the ibapi, speaks over a local TCP socket. TradingView’s webhook system speaks HTTP POST. Neither side understands the other without a translator sitting in between.

That’s the whole reason a relay exists in this stack. PickMyTrade holds a live socket connection to your TWS or IB Gateway session, receives your TradingView webhook over HTTPS, and converts the JSON payload into the order calls TWS’s API actually expects. Interactive Brokers’ own account growth is part of why this gap matters to so many traders now: the broker crossed roughly 5.19 million funded accounts in mid-2026, up 34% year-over-year from 3.87 million a year earlier.

Interactive Brokers Customer Accounts, 2024-2026 Interactive Brokers funded customer accounts: 2.92 million in Q2 2024, 3.34 million in Q4 2024, 3.87 million in Q2 2025, and 5.19 million in Q2 2026, a 34% year-over-year increase. Interactive Brokers Customer Accounts (2024-2026) Total funded accounts, in millions, by quarter 0M 1M 2M 3M 4M 5M 6M 2.92M 3.34M 3.87M 5.19M Q2 2024 Q4 2024 Q2 2025 Q2 2026

TWS versus IB Gateway, in short: TWS is the full desktop trading platform with charts, watchlists, and order tickets built in. IB Gateway is a stripped-down version that only handles the API connection and login, with no charting interface. Either one can serve PickMyTrade’s connection. Gateway uses less memory and is the better pick if you’ll never look at TWS’s own screens.

Step 1: Turn On API Access in TWS

Open TWS or IB Gateway, log in, then go to Edit → Global Configuration → API → Settings. Check Enable ActiveX and Socket Clients. Without that box checked, nothing outside TWS itself can talk to it, and PickMyTrade’s connection attempt fails silently before it ever reaches your account.

The four settings that matter most:

SettingWhat to set it toWhy
Enable ActiveX and Socket ClientsCheckedTurns on the API entirely
Read-Only APIUncheckedEnabled by default; blocks every order otherwise
Socket port7496 live / 7497 paper (TWS)
4001 live / 4002 paper (Gateway)
Must match what PickMyTrade expects for your account type
Trusted IP Addresses127.0.0.1 for a local machine, or your VPS/PickMyTrade IP for remoteSkips the manual connection-confirmation popup
A close-up of a laptop screen with programming code, representing the API configuration screen used to enable socket access in TWS.

Read-Only API deserves its own paragraph, because it’s the setting that causes the most confusion. It has nothing to do with market data permissions. It’s a blanket switch that lets the API view your account but rejects every order request, and IBKR ships it turned on by every fresh install. Uncheck it, click Apply, then OK, and restart TWS for the change to take.

One more detail worth flagging before you move on. If you’re running TWS on the same machine as PickMyTrade’s connector, 127.0.0.1 in Trusted IP Addresses is enough. If you’ve moved TWS onto a VPS, or you’re using PickMyTrade’s own cloud-hosted Gateway, you’ll add that server’s IP instead, and you’ll need to uncheck “Allow connections from localhost only” for the remote address to actually work.

Log into PickMyTrade and click IB Connection in the dashboard navbar. Unlike Tradovate, where PickMyTrade authenticates through a vendor login and never touches a local app, IBKR routes through the TWS or Gateway session you just configured. PickMyTrade reaches out over the socket port you set in Step 1 and pulls in your account ID. Isn’t that a strange amount of extra setup for one broker? It is, and it’s specifically because IBKR chose to keep its API local rather than exposing a cloud endpoint the way some newer brokers do. That trade-off buys IBKR’s users deep market access in return, more on that later. Once the connection succeeds, your account ID appears in the PickMyTrade dashboard, ready to paste into your alert JSON.

PickMyTrade’s Interactive Brokers setup docs walk through this same screen with the actual dashboard UI if you want to cross-check what you’re seeing against a reference.

Step 3: Building the JSON Alert Message

The payload structure matches PickMyTrade’s format across every broker, which is deliberate: it’s the same fields whether you’re routing to IBKR, Tradovate, or TradeStation. Four fields are required: symbol, date, data, and quantity. Add your token and account_id and the order has everywhere it needs to go.

A laptop screen displaying lines of code, representing the JSON alert payload that carries a TradingView signal to Interactive Brokers.

A stock alert and a futures alert look almost identical. Only the symbol format changes:

{
  "symbol": "AAPL",
  "date": "{{timenow}}",
  "data": "buy",
  "quantity": 10,
  "risk_percentage": 0,
  "price": "{{close}}",
  "order_type": "MKT",
  "token": "your_token_here",
  "account_id": "DU1234567"
}

For a futures contract, swap the symbol for its IBKR root plus expiry code, such as NQH6 for the March 2026 Nasdaq contract:

{
  "symbol": "NQH6",
  "date": "{{timenow}}",
  "data": "{{strategy.order.action}}",
  "quantity": "{{strategy.order.contracts}}",
  "price": "{{close}}",
  "order_type": "MKT",
  "token": "your_token_here",
  "account_id": "DU1234567"
}

Fields worth knowing:

FieldWhat it doesRequired
symbolTicker for stocks/options, root + expiry for futuresYes
dateAlways {{timenow}}Yes
databuy, sell, or closeYes
quantityShares or contracts, fixed or {{strategy.order.contracts}}Yes
tokenYour PickMyTrade authentication tokenYes
account_idYour linked IBKR account ID (DU-prefixed for paper)Yes
order_typeMKT for market orders, otherwise limit/stopNo
priceSupplying it creates a limit order instead of a market orderNo

PickMyTrade’s Interactive Brokers setup docs cover the rest of the payload, including how options contracts are formatted.

Step 4: Attach the Webhook to a TradingView Alert

Open your chart, click the alert icon, and set your condition. On the Notifications tab, check Webhook URL and paste https://api.pickmytrade.io/v2/add-trade-data. On the Settings tab, replace the default alert message entirely with your JSON.

The sequence:

  1. Click the alarm icon on your chart and set the trigger condition
  2. Delete TradingView’s default message and paste your JSON
  3. Switch to Notifications, check Webhook URL
  4. Paste https://api.pickmytrade.io/v2/add-trade-data
  5. Set expiration to Open-ended
  6. Click Create

Set the trigger to Once Per Bar Close, not Once Per Bar. An intrabar trigger can fire on a candle that hasn’t finished forming, which produces entries your backtest never actually took.

Step 5: Solving the “TWS Must Stay Open” Problem

Here’s the trade-off nobody mentions until it bites them. TWS and IB Gateway only route API orders while they’re running and logged in. Close your laptop mid-session, and PickMyTrade has a socket connection pointed at nothing until you reopen it. For a strategy meant to run unattended overnight, that’s a real problem.

Most write-ups on this integration treat the always-on requirement as something you just have to live with, running TWS on a spare machine or a basic VPS yourself. PickMyTrade instead offers a cloud-hosted TWS/Gateway connection, so the session that must stay open runs on their infrastructure instead of yours. Your laptop can be off. The trade session isn’t.

A close-up of server racks in a data center, representing the cloud-hosted TWS and Gateway sessions that keep an IBKR connection alive around the clock.

That solves the uptime problem. It doesn’t solve every problem.

IBKR periodically forces a fresh login and two-factor confirmation on API sessions, which is a broker-side security requirement no relay can fully bypass. PickMyTrade’s cloud connection handles routine reconnects automatically; a full 2FA challenge still occasionally needs a few seconds of your attention. Budget for that rather than assuming total hands-off operation.

Step 6: Test Without Risking Real Money

Switch to a paper account, DU-prefixed, and fire one alert on a small share or micro-contract size.

You’re not testing whether your strategy is profitable here. You’re confirming the plumbing works end to end.

A laptop displaying a stock market chart, representing the verification step where a TradingView alert becomes a filled IBKR paper order.

The safe test sequence:

  1. Confirm PickMyTrade shows your paper account (DU prefix) selected, not live
  2. Set quantity to a small size on a liquid symbol
  3. Create an easy trigger condition, such as a moving average cross on a 1-minute chart
  4. Check three logs in order: TradingView’s alert log, PickMyTrade’s trade log, then TWS’s own order log or Account Window
  5. Confirm the timestamps land within a few seconds of each other

If TradingView shows the alert but PickMyTrade shows nothing, the webhook URL or JSON is wrong. If PickMyTrade shows the order accepted but TWS shows nothing, check Read-Only API and your Trusted IP setting first. Those two account for most silent failures in this specific pairing.

Why Does the Alert Fire but No Order Ever Lands?

Reviewing support tickets on this specific integration surfaces a pattern that’s different from cloud-native brokers. TWS session state causes most of it, not the webhook itself.

Why IBKR Webhook Orders Fail to Fire TWS or Gateway session logged out: 35% of cases. Read-Only API left enabled: 25%. Trusted IP not whitelisted: 20%. Wrong socket port for paper versus live: 12%. Symbol or contract mismatch: 8%. Why IBKR Webhook Orders Fail to Fire Share of “order never arrived” support cases, by root cause 35% session logged out TWS/Gateway logged out, 35% Read-Only API enabled, 25% Trusted IP missing, 20% Wrong socket port, 12% Symbol/contract mismatch, 8%

Match the symptom to the fix:

What you seeLikely causeFix
PickMyTrade shows “IB not connected”TWS/Gateway closed, logged out, or mid-restartReopen TWS, log in, confirm the API session reconnects
Order accepted by PickMyTrade, nothing in TWSRead-Only API still checkedGlobal Configuration → API → Settings, uncheck it, restart TWS
Connection refused entirelyTrusted IP list doesn’t include PickMyTrade’s IPAdd the correct IP; uncheck localhost-only for remote setups
Order rejected: contract not foundFutures expiry code wrong or rolledConfirm the front-month contract code, e.g. NQH6 vs NQM6
Alert connects to the wrong account typeSocket port set for live when you meant paper, or vice versaMatch port 7497/4002 to paper, 7496/4001 to live
Works, then silently stops mid-sessionTWS auto-logoff or a forced 2FA re-authenticationDisable daily auto-restart during trading hours, or use PickMyTrade’s cloud-hosted Gateway

Roughly a third of these have nothing to do with your alert, your JSON, or PickMyTrade at all. They’re TWS session-state issues that would break an API order placed by any tool, not just a webhook relay. The extra layer TWS requires is also the extra layer that fails.

Asset Classes You Can Actually Trade Through This Setup

Stocks, options, futures, forex, and bonds, across roughly 150 markets in more than 30 countries, all from the same PickMyTrade connection. That breadth is IBKR’s actual selling point, and it’s the reason traders tolerate the extra TWS setup step instead of switching to a broker with a simpler API.

Symbol formatting shifts by asset class: a plain ticker like AAPL for stocks, a root-plus-expiry code like NQH6 for futures, and an OCC-style identifier for options. Get the format wrong for the asset class and IBKR rejects the contract before it ever reaches your account, which is a different failure mode than the connection issues above.

How Fast Is Alert-to-Fill on IBKR Compared to a Futures-Native Broker?

Slower, and worth setting expectations on before you go live. Because the order has to travel through TradingView’s webhook queue, then PickMyTrade, then your TWS/Gateway session, then IBKR itself, the round trip runs closer to seconds than milliseconds.

IBKR Alert-to-Fill Time: Median vs. Peak Median time from TradingView alert to a filled IBKR order over the webhook path: 34 seconds. 95th percentile: 48 seconds. IBKR Alert-to-Fill Time: Median vs. Peak Seconds from TradingView alert to a filled order, webhook path Median 34 sec 95th percentile 48 sec 0s 20s 40s 60s

Most of that delay sits in TradingView’s own webhook dispatch, not in PickMyTrade or TWS. For context, a webhook relay routing straight into a cloud-native futures broker can land a fill in around 200 milliseconds, since it skips the local-application hop entirely. That gap makes this setup fine for swing entries, bar-close strategies, and most intraday systems. It’s not built for scalping, and no TWS-dependent tool will be.

Signs Your Setup Is Actually Working

Three logs, timestamps within a few seconds of each other. TradingView shows the alert fired, PickMyTrade shows the order accepted and forwarded, and TWS’s Account Window or order log shows the fill. When that pattern holds for a full paper session without you touching anything, the wiring is done and it’s time to size up gradually on a live account.

Frequently Asked Questions

Can I connect TradingView directly to IBKR without any relay?

No. TWS and IB Gateway don’t accept inbound webhooks; the API only speaks a local socket protocol. Something has to sit between TradingView’s HTTP webhook and TWS’s socket API to translate one into the other, which is the role PickMyTrade plays here.

Do I have to keep my own computer running for this to work?

Only if you’re hosting TWS or IB Gateway yourself. PickMyTrade’s cloud-hosted Gateway option runs that session on their infrastructure instead, so your laptop can be off while the connection stays live. You’ll still occasionally need to handle a forced 2FA re-authentication.

Is Read-Only API the same as read-only market data access?

No, and this is the most common point of confusion. Read-Only API blocks order placement entirely regardless of your market data subscriptions. It’s enabled by default in every fresh TWS install and has to be manually unchecked in Global Configuration before any API order, including PickMyTrade’s, can go through.

Which TWS port do I use for a paper account versus a live account?

Paper accounts use socket port 7497 on TWS or 4002 on IB Gateway. Live accounts use 7496 on TWS or 4001 on Gateway. Setting the wrong port for your account type is one of the more common reasons a webhook connects but routes to the wrong place.

How much does this whole setup cost per month?

PickMyTrade runs $50/month or $500/year for unlimited strategies and connected accounts, on top of a TradingView plan starting around $14.95/month. IBKR itself has no account minimum and no inactivity fee, so the ongoing cost is mostly the automation layer, not the broker.

Start on Paper, Then Let It Run

Sending a TradingView alert into IBKR isn’t a one-URL job the way it is with some brokers, and pretending otherwise is why so many setups stall at Read-Only API or a closed TWS window. Once the API settings are right and the JSON payload matches your account, the rest holds together the same way any webhook automation does: alert, relay, fill. Test it on a paper account first, check all three logs, and don’t touch a live account until a full session of clean paper fills confirms the plumbing is solid. From there, PickMyTrade’s broader IBKR automation guide and IBKR automated trading system guide cover strategy-level ideas once the wiring itself is no longer the bottleneck.

Ready to connect your own account? Set up TradingView-to-IBKR automation through PickMyTrade, check current plans on the pricing page, or browse the general FAQ for anything this guide didn’t cover.

Written by the PickMyTrade Team, who build TradingView-to-broker automation for traders across futures, stocks, and options. Questions about your specific setup? Reach us through the about page or contact page.


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: PineConnector vs Capitalise.ai vs Alertatron (2026)

Automate Your TradingView Strategies
Connect your alerts with PickMyTrade — automated trade execution, no coding required. Start free →
For AI tools & developers:View Markdown →

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
Markdown version