Pine Script Alerts to IBKR: Webhook Checklist for Options
Field-by-field checklist for sending TradingView Pine alerts to IBKR via webhook relays — symbology, paper testing, duplicates, and when to use chart-native tools instead.
Pine Script alerts to IBKR work by posting structured JSON from TradingView to a webhook relay, which maps fields to IBKR TWS API orders — validate symbology and paper trade before live options automation.
Prerequisite: TradingView Webhook Automation. Playbook: Options Trading Automation. Local alternative: Connect IBKR for chart clicks.
End-to-end path
Pine strategy / indicator
↓ alert() on condition
TradingView servers → HTTPS POST
↓
Your relay (PickMyTrade, TradersPost, custom)
↓
IBKR Client (TWS / Gateway API)
↓
US options matching
IBKR API background: IBKR API. TradingView alerts: Creating alerts.
Pine alert design rules
1. Fire frequency
alert.freq style | Use case |
|---|---|
| Once per bar close | Reduce duplicate fires on intrabar noise |
| Once per bar | Faster but noisier |
Document your choice in the strategy readme — relays rarely fix bad alert cadence.
2. Message contract (template)
Define a frozen JSON schema your relay expects. Example illustrative shape (relay-specific — do not copy blindly):
{
"action": "buy",
"symbol": "SPY",
"expiry": "20260620",
"strike": 500,
"right": "C",
"qty": 1,
"order_type": "LMT",
"limit": 2.45,
"account": "paper"
}
Your relay's docs override everything. OptionTrigger does not consume this format.
3. Options symbology checklist
| Field | Verify |
|---|---|
| Underlying | Matches IBKR symbol (SPY vs SPXW different products) |
| Expiry | YYYYMMDD vs relay format |
| Strike | Numeric, correct scale |
| Right | C/P enum matches relay |
| Multiplier | 100 for standard US equity options |
| Trading class | Index vs ETF weeklies |
4. Bracket / TP/SL in JSON
If the relay supports brackets, include:
- Take-profit price or % on premium
- Stop-loss price or % on premium
- Time-in-force
Mismatch here is why many traders prefer premium-based chart TP/SL for discretionary trades.
IBKR session requirements
Before arming alerts:
- TWS or IB Gateway running (unless relay hosts session differently)
- API enabled — IBKR TWS Configuration
- Port matches relay config (7496 common for OptionTrigger stack; relay may differ)
- Options permissions active
- Market data for contract you alert on
Paper staging procedure
| Step | Action |
|---|---|
| 1 | Create alert on chart with paper relay profile |
| 2 | Fire once manually (test button) — inspect raw POST in relay logs |
| 3 | Confirm one order in IBKR paper TWS |
| 4 | Break JSON on purpose — confirm relay rejects safely |
| 5 | Run 20 sessions across open/close volatility |
Full paper guide: Paper Trade Options on TradingView.
Duplicate order prevention
| Layer | Tactic |
|---|---|
| Pine | alert.freq_once_per_bar_close; avoid repainting signals without understanding them |
| Chart | One webhook per strategy instance |
| Relay | Idempotency key = alert time + symbol + side |
| IBKR | Disable duplicate client IDs if self-hosting API |
Multi-leg alerts (caution)
If your alert tries to fire two or four legs:
- Confirm relay sends combo not sequential legs
- Otherwise use TWS manual combo — Multi-Leg Orders
- Iron condor / vertical tutorials: Iron Condor, Vertical Spread
OptionTrigger remains single-leg for chart execution.
When to skip webhooks entirely
Choose chart-native execution if:
- Trades are discretionary per session
- You want drawn TP/SL without maintaining JSON templates
- You prefer local routing — OptionTrigger Desktop
Compare vendors: /compare/optiontrigger-vs-pickmytrade.
Related guides
| Article | Topic |
|---|---|
| IBKR + TradingView | Permissions, data, paths |
| TradingView Webhook Automation | Architecture |
| Trade Options on TradingView | Hub |
- Trade Options on TradingView — brokers, tools, workflows
- Options Trading Automation Playbook — webhooks vs chart-native execution
- IBKR + TradingView for Options — permissions, TWS, troubleshooting