Skip to content

Guide

How to connect TradingView webhooks to Alpaca

TradingView cannot post a webhook directly to Alpaca. An alert sends a message to a URL; Alpaca is a broker, not an endpoint that reads alert text and places orders. The route is: TradingView posts to Nyria's webhook URL, and Nyria places the order at Alpaca. Here are the five steps to set that up, an example alert, and the paper run to do first.

Set it up in five steps

  1. 1

    Generate an Alpaca API key

    Sign in at alpaca.markets. In the dashboard, go to Paper Trading or Live Trading, select API Keys, and generate a new key. Copy the key and secret now: the secret is shown once. Keep them out of any shared file.

  2. 2

    Connect Alpaca to Nyria

    Sign in to Nyria, select Integrations, and pick the Alpaca card. Paste the API key and secret. For a paper run, use a Paper Trading key. For live orders, use a Live Trading key from a funded account with the permissions your trades need.

  3. 3

    Create a strategy in Nyria

    Go to My strategies and select Create strategy. Name it and pick TradingView as the alert source. Nyria shows the strategy's webhook URL. Copy it.

  4. 4

    Paste the webhook URL into TradingView

    In TradingView, create a new alert on your chart, indicator or strategy. On the Notifications tab, check Webhook URL and paste Nyria's strategy URL. In the Message field, write the alert text: the ticker, the action, and for options the contract. Webhooks need a paid TradingView plan with two-factor sign-in on.

  5. 5

    Deploy a paper bot and check the logs

    Back in Nyria, deploy a bot on Alpaca Paper. Let the chart fire a real alert and open the bot's Logs tab. Each alert and the order it caused are recorded. Confirm the ticker, side and quantity match. When they do, deploy a bot on the live Alpaca account.

Alpaca's paper and live accounts have separate keys. Connect the paper key first, and add the live key when you go live.

A worked example

Stocks, long only. Entries are market orders; exits are market orders on the exit alert.

Entry alert message in TradingView

long AAPL

Exit alert message

exit AAPL long

A bot on the strategy uses a $1,000 budget per entry. The entry alert fires; Nyria reads "long AAPL", checks the latest quote, and sends Alpaca a market order for the number of whole shares $1,000 covers. When the exit fires, Nyria closes whatever AAPL the bot holds. Nothing in the message sets the size: the budget on the bot does. The Logs tab shows the alert text, the order sent and Alpaca's fill.

What Nyria trades at Alpaca

US stocks and ETFs in whole shares, options up to 4 legs, and crypto spot. Nyria sends market and limit orders, as the strategy sets them, and attaches no stop or target to an entry: closes come from your exit alerts. Short selling needs a margin account at Alpaca. Stock orders go in during regular market hours; crypto trades around the clock.

Alpaca's own docs at docs.alpaca.markets cover order types, asset restrictions and account requirements. The Alpaca integration page lists what Nyria specifically places.

Questions

Does TradingView connect to Alpaca directly?
Not for alerts. A TradingView alert can only send its message to a URL. A receiver such as Nyria reads the message and places the order at Alpaca.
Do I need TradingView's paid plan?
Yes. TradingView sends webhooks on its paid plans only, with two-factor sign-in turned on. Nyria itself is free to test on paper.
What does Nyria trade at Alpaca?
US stocks and ETFs in whole shares, options up to 4 legs, and crypto spot. Exits come from your exit alerts.
Can I test without funding a live Alpaca account?
Yes. Alpaca has a paper trading environment with its own API keys. Use a Paper Trading key in Nyria to test all the way through without real money.
What if the alert fires but no order appears?
Open the Logs tab on the bot. Each alert Nyria received is logged with the reason it placed or refused an order. Common reasons: the bot is paused, the Budget per entry is below the price of one share, or the alert names no ticker.

Test on Alpaca Paper first

Paper is free. Live trading from $15 a month.