IntelliTrade Education
← Dashboard Get IntelliTrade

TradingView: Custom Scripts, Alerts & Webhooks

How to use TradingView's charting platform, write custom Pine Script indicators, set up alerts, and connect webhooks to automate real trades through IntelliTrade.

Intermediate 16 min read

What Is TradingView?

TradingView is the world's most popular charting and social trading platform. It provides real-time charts, technical analysis tools, custom scripting (Pine Script), and a social community of millions of traders.

What makes TradingView essential for modern trading:

200+
Built-in Indicators
< 2s
Webhook-to-Trade Latency
100M+
Active Users Worldwide
Pine v5
Custom Scripting Language
  • Browser-based — No downloads needed, works on any device with a web browser
  • Real-time data — Stocks, futures, forex, crypto, and options data from global exchanges
  • Pine Script — A purpose-built programming language for creating custom indicators and strategies
  • Alerts — Set conditions that trigger notifications via email, app, SMS, or webhook
  • Community — Thousands of free public indicators and scripts shared by other traders
Free vs. Paid: TradingView offers a free tier with basic charting and 1 alert. Paid plans (Essential, Plus, Premium) unlock more alerts, indicators per chart, and features. For webhook-based automation, you need at least the Essential plan ($12.95/month) or higher.

Charting and Technical Analysis

TradingView's charting engine is its core strength. You can analyze any instrument with dozens of chart types and hundreds of built-in indicators.

Key Chart Features

Chart Types

Candlestick, Heikin Ashi, Renko, Range, Line, Area, and more. Most traders use candlestick charts for their rich price action information (open, high, low, close).

Timeframes

From 1-second to monthly charts. Futures traders typically use 1-min, 5-min, and 15-min for intraday. Swing traders use daily and weekly. You can view multiple timeframes simultaneously.

Drawing Tools

Trend lines, Fibonacci retracements, horizontal levels, channels, rectangles, and pitchforks. These help identify support, resistance, and price patterns visually.

Built-in Indicators

200+ indicators: Moving Averages (SMA, EMA), RSI, MACD, Bollinger Bands, VWAP, Volume Profile, ATR, and more. Apply multiple indicators to any chart.

Popular Indicators for Futures Traders

Indicator Purpose Typical Use
VWAP Volume-weighted average price Intraday fair value; price above VWAP = bullish bias
EMA 9/21 Short-term trend direction EMA crossover signals momentum shifts
ATR Average True Range (volatility) Set stop-loss distances and position sizes
Volume Profile Price levels with most trading volume Identify support/resistance at high-volume nodes
RSI Relative Strength Index (momentum) Overbought (>70) or oversold (<30) conditions

Pine Script: Custom Indicators

Pine Script is TradingView's built-in scripting language. It lets you create custom indicators, strategies, and alerts that go far beyond the built-in tools.

What Can You Build?

  • Custom indicators — Plot your own calculations, signals, and overlays on charts
  • Strategy scripts — Backtest trading ideas with historical data (entries, exits, P/L)
  • Alert conditions — Define complex conditions that trigger alerts (and webhooks)
  • Visual tools — Draw zones, labels, tables, and annotations on charts programmatically

Pine Script Basics

Pine Script uses a simple, purpose-built syntax. Here's a basic example that plots an EMA crossover signal:

//@version=5
indicator("EMA Crossover Signal", overlay=true)

// Define two EMAs
fast = ta.ema(close, 9)
slow = ta.ema(close, 21)

// Plot the EMAs
plot(fast, "Fast EMA", color=color.blue, linewidth=2)
plot(slow, "Slow EMA", color=color.orange, linewidth=2)

// Detect crossovers
bullCross = ta.crossover(fast, slow)
bearCross = ta.crossunder(fast, slow)

// Plot signals on chart
plotshape(bullCross, "Buy", shape.triangleup,
    location.belowbar, color.green, size=size.small)
plotshape(bearCross, "Sell", shape.triangledown,
    location.abovebar, color.red, size=size.small)

// Create alert conditions
alertcondition(bullCross, "EMA Bull Cross",
    "EMA 9 crossed above EMA 21")
alertcondition(bearCross, "EMA Bear Cross",
    "EMA 9 crossed below EMA 21")
                
Learning Pine Script: TradingView provides comprehensive documentation at their Pine Script Reference. Start with simple indicators and gradually add complexity. The community forums and public script library are excellent resources for learning patterns.

Opening Range Breakout (ORB) in Pine Script

IntelliTrade uses a custom Pine Script for the Opening Range Breakout strategy on futures. The script calculates the first N minutes of the trading session (the "opening range") and triggers alerts when price breaks above or below that range:

//@version=5
indicator("ORB - Opening Range Breakout", overlay=true)

// Inputs
orbMinutes = input.int(3, "ORB Minutes", minval=1, maxval=30)
sessionStart = input.session("0930-0933", "ORB Session")

// Track opening range high/low
var float orbHigh = na
var float orbLow = na

inORB = not na(time(timeframe.period, sessionStart))

if inORB
    orbHigh := na(orbHigh) ? high : math.max(orbHigh, high)
    orbLow  := na(orbLow)  ? low  : math.min(orbLow, low)

// Plot ORB levels
plot(orbHigh, "ORB High", color.green, style=plot.style_line)
plot(orbLow,  "ORB Low",  color.red,   style=plot.style_line)

// Breakout detection
longBreak  = ta.crossover(close, orbHigh)
shortBreak = ta.crossunder(close, orbLow)

alertcondition(longBreak,  "ORB Long",  "Price broke above ORB High")
alertcondition(shortBreak, "ORB Short", "Price broke below ORB Low")
                

Setting Up Alerts

Alerts are TradingView's notification system. They monitor your conditions 24/7 on TradingView's servers — your computer doesn't need to be on.

Types of Alert Conditions

Price Alerts

Simple price level triggers

Example: "ES crosses above 6050"

Best for support/resistance levels

Plan: Free

Indicator Alerts

Built-in indicator conditions

Example: "RSI crosses below 30"

Works with any plotted indicator

Plan: Free

Custom Script Alerts

alertcondition() in Pine Script

Define any logic you want

Powers IntelliTrade webhook automation

Plan: Essential+

Strategy Alerts

strategy.entry() triggers

Fires on backtest entry/exit orders

Automate backtested strategies

Plan: Essential+

Creating an Alert

  1. Right-click on the chart or click the alarm clock icon
  2. Select the Condition (price level, indicator, or Pine Script alert)
  3. Configure trigger settings (once, once per bar close, every time)
  4. Set expiration (alerts auto-expire on free plans; paid plans can run indefinitely)
  5. Choose notification method: popup, email, SMS, app notification, or webhook URL
  6. Write the alert message (can include dynamic variables)
Alert Limits: Free accounts get 1 active alert. Essential: 20. Plus: 100. Premium: 400. For automated trading with multiple instruments and conditions, you'll likely need Plus or Premium.

Webhooks: From Alert to Trade

A webhook is an HTTP request that TradingView sends to a URL when an alert fires. This is the bridge between your TradingView analysis and real trade execution.

How Webhooks Work

1

TradingView Alert Fires

Your Pine Script condition is met (e.g., ORB breakout). TradingView's cloud servers detect it 24/7.

2

HTTP POST to Webhook URL

TradingView sends a JSON payload to your configured endpoint with ticker, action, price, and parameters.

3

IntelliTrade Bridge Receives

Validates the auth token, parses trade parameters, and applies risk checks (position limits, daily loss).

4

Broker API Execution

Places a bracket order on Interactive Brokers: entry + stop-loss + take-profit. All within ~2 seconds.

5

Confirm & Log

Fill confirmation is received, trade is logged to the database, and P/L tracking begins on the dashboard.

Setting Up a Webhook Alert

  1. Create your alert condition as normal
  2. In the alert dialog, check the "Webhook URL" checkbox
  3. Enter your webhook endpoint URL (e.g., https://your-server.com/webhook)
  4. Write a JSON message in the alert body (this is the payload your server receives)
Security: Your webhook URL receives trade instructions, so it must be secured. Use HTTPS, include a secret token in the payload, validate all incoming data, and never expose your webhook URL publicly. IntelliTrade's bridge includes authentication and IP filtering for safety.

JSON Alert Payloads

The alert message body is sent as the webhook's HTTP POST body. You write this in the alert creation dialog using JSON format with TradingView's dynamic variables.

Basic Payload Structure

"action" : "buy" , "ticker" : "{{ticker}}" , "price" : {{close}}
"quantity" : 1 , "account" : "DU12345" , "secret" : "your-auth-token"

The {{variables}} are TradingView dynamic placeholders, replaced at alert time with real values. The secret authenticates the webhook to prevent unauthorized trades.

TradingView Dynamic Variables

Variable Description Example Output
{{ticker}} Symbol of the chart MESM2026
{{close}} Current close price 6052.25
{{open}} Current open price 6048.50
{{high}} Current bar high 6055.00
{{low}} Current bar low 6047.75
{{volume}} Current bar volume 15234
{{time}} Bar time (UTC timestamp) 2026-02-27T14:35:00Z
{{exchange}} Exchange name CME_MINI
{{interval}} Chart timeframe 5

Advanced Payload Example

A complete webhook payload for an ORB breakout trade with risk management:

{
    "action": "{{strategy.order.action}}",
    "ticker": "{{ticker}}",
    "price": {{close}},
    "order_type": "limit",
    "quantity": 2,
    "stop_loss": {{plot("stop")}},
    "take_profit": {{plot("target")}},
    "strategy": "ORB_v11",
    "timeframe": "{{interval}}",
    "account": "DU12345",
    "secret": "abc123-your-secret-token"
}
                

IntelliTrade + TradingView Integration

IntelliTrade's IBKR Webhook Bridge is designed to receive TradingView webhook alerts and execute trades through Interactive Brokers. This is how the futures trading system works, combining webhook execution with GEX analysis for market context.

Architecture

TradingView Cloud Pine Script + Alert HTTPS POST (JSON) IntelliTrade Bridge Auth + Risk Checks Interactive Brokers TWS / IB Gateway Exchange (CME/CBOE) Fill Confirmation Fill + P/L logged
TradingView webhook architecture: Alert fires in the cloud, IntelliTrade bridge validates and routes to IBKR, exchange fills the order, and the result is logged back to the dashboard.

What the Bridge Handles

  • Authentication — Validates the secret token in every incoming webhook
  • Order routing — Maps TradingView ticker symbols to IB contract specifications
  • Risk management — Enforces position limits, daily loss limits, and account restrictions
  • Bracket orders — Attaches stop-loss and take-profit orders automatically
  • Fill tracking — Monitors order fills and updates the trade database
  • Webhook log — Records every incoming webhook for debugging and audit
Hands-Free Execution: Once your TradingView alert and IntelliTrade bridge are configured, the entire flow is automated. Your Pine Script detects a signal, TradingView fires the webhook, the bridge validates and sends it to IB, and the trade is placed — all in under 2 seconds. You can be away from your computer entirely. For SPX options, IntelliTrade's auto-trading agents handle trade generation natively without TradingView.

Example: Opening Range Breakout Strategy

IntelliTrade's futures module uses a TradingView-based Opening Range Breakout (ORB) strategy. Here's how all the pieces fit together:

The ORB Flow

1

Market Opens 9:30 AM ET

Pine Script starts tracking the first 3 minutes of price action to build the opening range.

2

9:33 AM: Range Defined

Opening range high and low are locked in from the first 3 candles. Levels are plotted on the chart.

3

Breakout Detected

Price closes above ORB high (bullish) or below ORB low (bearish). Alert condition triggers.

4

Webhook Fires → Bridge

TradingView sends JSON with action, price, stop, and target. Bridge validates and applies risk checks.

5

Bracket Order Placed

Entry + stop-loss + take-profit at 2:1 reward-to-risk. After partial fill, trailing stop activates.

ORB Alert JSON

{
    "action": "buy",
    "ticker": "MES",
    "price": 6052.25,
    "stop_loss": 6044.50,
    "take_profit": 6067.75,
    "quantity": 2,
    "strategy": "ORB_v11",
    "risk_pts": 7.75,
    "reward_pts": 15.50,
    "orb_high": 6052.00,
    "orb_low": 6044.50,
    "secret": "your-token"
}
                

Risk Parameters

Parameter Value Purpose
ORB window First 3 minutes Defines the breakout range
Reward:Risk 2:1 minimum Take profit at 2x the stop distance
Max daily loss $500 Stop trading after cumulative loss limit
Max contracts 2 MES Position size limit per trade
Trading window 9:33 AM – 11:00 AM ORB signals only valid in first 90 minutes
Trailing stop After +$100 profit Trail stop to lock in gains

Best Practices

Pine Script Tips

  • Use barstate.isconfirmed — Only fire signals on confirmed (closed) bars to avoid false triggers from incomplete candles
  • Add filters — Combine your signal with volume confirmation, trend filters, or time-of-day restrictions
  • Backtest first — Use strategy() mode to test your logic on historical data before going live
  • Version your scripts — Always use //@version=5 and keep copies of working versions
  • Avoid repainting — Ensure your indicator doesn't change historical values (test with bar replay)

Webhook Tips

  • Always include a secret token — Authenticate every webhook to prevent unauthorized trades
  • Use "Once Per Bar Close" — Avoids multiple signals from the same candle
  • Test with paper trading — Run your webhook pipeline with a paper trading account before going live
  • Monitor the webhook log — IntelliTrade logs every incoming webhook at /futures?tab=webhook-log
  • Set up fallback alerts — Send both webhook + email so you're notified if the webhook fails
  • Use ngrok or a tunnel — For local development, use a secure tunnel to expose your webhook bridge to TradingView's servers
Getting Started: If you're new to TradingView, start with the free plan to explore charting and indicators. When you're ready to automate, upgrade to Essential or Plus for webhook support, set up the IntelliTrade IBKR Bridge, and start with paper trading. The IntelliTrade dashboard provides setup instructions at the TV Alerts page. For 0DTE options strategies, IntelliTrade automates the entire process without TradingView.

Ready to trade smarter?

IntelliTrade automates options and futures trading with GEX analysis, AI insights, and risk management.

Learn More at IntelliTrade.live →