Skip to content
  • Documentacion

Start Here

8
  • What’s TradeAdapter
  • How TradeAdapter works
  • Supported Platforms & Brokers
  • Requirements
  • Quick Start
  • Indicator vs Strategy
  • Strategy Example
  • Safety & Risk Disclaimer

Direct API

15
  • Overview
  • Binance Guide
  • Binance US Guide
  • Bybit Guide
  • MEXC Guide
  • Kucoin Guide
  • Kraken Guide
  • Coinbase Guide
  • OKX Guide
  • BingX Guide
  • Bitget Guide
  • Gate.io Guide
  • Alpaca Guide
  • Capital Guide
  • OANDA Guide

MetaTrader

6
  • Overview
  • MT4 Setup
  • MT5 Setup
  • TradingView Alerts
  • EA Settings
  • Symbol alignment

FAQ

7
  • Overview
  • Binance
  • Bybit
  • Bitget
  • TradingView
  • Metatrader
  • Other
View Categories
  • Home
  • Docs
  • Direct API
  • Alpaca Guide

Alpaca Guide

Alpaca Guide

Connect TradingView to Alpaca (stocks & forex) using TradeAdapter’s direct API integration. This guide covers strategy and indicator alerts with the Message Generators.

Video walkthrough #

Alpaca + TradingView setup

1 — Create Alpaca account and API keys #

Alpaca is a US broker for stocks and forex. Create an account and generate API keys from the Dashboard.

  1. Register at Alpaca

    Go to alpaca.markets and complete registration. Confirm your email to verify the account.

  2. Log in to the Dashboard

    Once the account is activated, log in at app.alpaca.markets and open the Dashboard section.

  3. Generate API keys

    On the Dashboard you can generate keys for your Demo (Paper) account. Copy and store your API Key and Secret — you will use them in the alert message as alpaca_api_key and alpaca_api_secret. For live trading, use the keys from your live account.

TradeAdapter: Create Alpaca Account (step-by-step)

2 — Select the Alpaca symbol in TradingView #

Open TradingView and search for the symbol using the Alpaca (or broker) prefix. Alpaca supports stocks and forex — the {{ticker}} placeholder will send this symbol to TradeAdapter.

Important

The symbol must be valid on Alpaca and match what you trade. Use order_market": "Spot" in your message.

3 — Add your strategy or indicator #

Alpaca supports both strategy and indicator alerts. Load your Pine Script onto the chart so it generates the trading signals.

Strategy

Use the Alpaca Message Generator (Strategy). One alert with trigger “Order fills only”. TradingView fills action, size, and price via {{strategy.order.action}}, {{strategy.order.contracts}}, {{strategy.order.price}}.

Indicator

Use the Alpaca Message Generator (Indicator). Set order_action and order size manually in the message. Create one alert per action (e.g. Buy, Sell).

Not sure if you have a strategy or an indicator? See Indicator vs Strategy.

4 — Configure order size #

Set your strategy’s position size so that {{strategy.order.contracts}} is valid for the symbol on Alpaca. For Limit orders, ensure {{strategy.order.price}} is in the correct format. For indicators, set the order size in the message accordingly.

5 — Create the TradingView alert #

Press Alt + A (or the alarm clock icon) to create a new alert.

Strategy → one alert

Under Condition, select your strategy and set trigger to “Order fills only”. TradingView fills action, size, and price via the strategy placeholders.

Alpaca: different Webhook URL for Demo vs Real

In Notifications, enable Webhook URL and paste one of these URLs from your TradeAdapter profile:

  • Demo (paper): https://tradeadapter.com/api/alpaca/demo_order
  • Real (live): https://tradeadapter.com/api/alpaca/real_order

Paste the JSON message in the Message field. Build it with the Alpaca Message Generator (Strategy) or Alpaca Message Generator (Indicator).

Alert message (Strategy) #

Use this template for strategy-based alerts. Replace the placeholder values with your Alpaca API key and secret. Keep order_market as Spot. Keep the TradingView placeholders as-is.

Strategy → Alpaca Message
{
    "alpaca_api_key": "PUT YOUR ALPACA API KEY HERE",
    "alpaca_api_secret": "PUT YOUR ALPACA SECRET HERE",
    "real_order": "No",
    "order_market": "Spot",
    "order_type": "Market",
    "isolated_margin": "No",
    "exchange": "Alpaca",
    "ticker": "{{ticker}}",
    "time": "{{timenow}}",
    "order_contracts": "{{strategy.order.contracts}}",
    "order_action": "{{strategy.order.action}}",
    "order_price": "{{strategy.order.price}}"
}

Open Alpaca Message Generator (Strategy)

Open Alpaca Message Generator (Indicator)

Message fields explained #

Field Description
alpaca_api_key Your Alpaca API Key from the Alpaca Dashboard (paper or live).
alpaca_api_secret Your Alpaca Secret. Store it securely and never share it.
real_order "Yes" sends real orders to Alpaca. "No" sends test orders via TradeAdapter only. Use the matching Webhook URL (demo_order vs real_order) for your choice.
order_market Use "Spot" for Alpaca.
order_type "Market" or "Limit". For Limit orders, order_price is used as the limit price.
isolated_margin Keep "No" for Spot. Only relevant if Alpaca supports margin in your setup.
exchange Must be "Alpaca" so TradeAdapter routes the order to Alpaca.
ticker The TradingView symbol from {{ticker}} (e.g. Alpaca symbol).
order_contracts Position size from your strategy ({{strategy.order.contracts}}).
order_action "BUY" or "SELL". Use {{strategy.order.action}} for strategies.
order_price Price from the strategy ({{strategy.order.price}}), used for Limit orders.

6 — Execute & monitor #

  1. Start with demo

    Use the demo_order webhook URL and set "real_order": "No". Trigger a few alerts and check MyTrades to see how TradeAdapter interprets your signals.

  2. Switch to live when ready

    Use the real_order webhook URL and set "real_order": "Yes". Monitor your Alpaca account to confirm orders execute as expected.

  3. Recreate alerts after changes

    If you change strategy parameters or the message, delete and recreate the TradingView alert so the new values are applied.

Important notes #

🔑
API security — Never share your Secret. Get keys from Alpaca Dashboard (paper or live).
🔗
Correct Webhook URL — Demo account → demo_order URL; Real account → real_order URL. Your TradeAdapter profile has both.
🔄
Recreate alerts after changes — If you change strategy/indicator parameters or message fields, delete and recreate the TradingView alert.
📈
Monitor MyTrades — Use TradeAdapter’s MyTrades to verify what orders are being sent.

Need a different platform?
All setup guides
Updated on February 25, 2026

What are your Feelings

  • Happy
  • Normal
  • Sad

Share This Article :

  • Facebook
  • X
  • LinkedIn
  • Pinterest
Gate.io GuideCapital Guide
Table of Contents
  • Video walkthrough
  • 1 — Create Alpaca account and API keys
  • 2 — Select the Alpaca symbol in TradingView
  • 3 — Add your strategy or indicator
  • 4 — Configure order size
  • 5 — Create the TradingView alert
  • Alert message (Strategy)
  • Message fields explained
  • 6 — Execute & monitor
  • Important notes
© 2026 • Built with GeneratePress