TradingView Alpaca automation lets you turn a chart alert into a live US stock order automatically. As of July 2026, the setup is close to free: Alpaca offers commission-free trading on US-listed stocks and ETFs plus an unlimited, no-cost paper-trading account, and its REST API is open to every user. You can connect the two in one of three ways — TradingView’s built-in Alpaca broker integration, a no-code bridge, or a self-hosted Python webhook relay. The only unavoidable cost is a paid TradingView plan (from $14.95/month), because free Basic accounts cannot send webhooks.
I’m Jayadev Rana, a TradingView-certified Pine Script developer. Across 8 years and 7,700+ strategies for traders in 14+ countries, the TradingView-to-Alpaca pipeline is one I wire up almost every week for US clients — so this is the same checklist I hand them.
Why Alpaca is the go-to broker for TradingView automation
Alpaca was built API-first, which is exactly what you want for automation. The facts that matter as of July 2026:
- Commission-free US stocks, ETFs and options. Self-directed individual accounts trade 11,000+ US-listed stocks and ETFs at zero commission through the API. Crypto carries a 0.25% fee, and regulatory/exchange fees still pass through on live orders.
- Free, unlimited paper trading. Every user gets a simulated account at
paper-api.alpaca.marketsthat mirrors the live API, so you can test a full strategy without risking a cent. - Clean REST API and official SDK. Bearer-token auth plus the
alpaca-pyPython SDK make order placement a few lines of code. - No inactivity or maintenance fees. Deposits and ACH withdrawals are free; wire transfers cost $25 domestic and $50 international.
One honest caveat: Alpaca’s free market data is delayed 15–20 minutes, so a strategy that needs real-time quotes will require a paid data subscription. Certain Elite Smart Router arrangements can also change the commission picture.
What you need before you start
Two accounts — and only one of them has a cost:
- An Alpaca account. Open the paper account first; it is free.
- A TradingView plan that supports webhooks. This is the catch. TradingView’s free Basic plan only sends pop-up and email alerts — it cannot fire a webhook. The cheapest tier that includes webhook URLs is Essential, and you must enable two-factor authentication (2FA).
| TradingView plan | Webhook alerts? | List price (monthly) |
|---|---|---|
| Basic (free) | No | $0 |
| Essential | Yes (20 price + 20 technical alerts) | $14.95 (about $12.95 billed annually) |
| Plus | Yes (more alerts & charts) | $34.95 |
| Premium | Yes (highest limits) | $69.95 |
For most single-strategy Alpaca setups, Essential is plenty.
Three ways to connect TradingView alerts to Alpaca
1. TradingView’s built-in Alpaca integration
Alpaca is a natively supported broker inside TradingView’s trading panel. Once connected, you can place and manage orders in US stocks, ETFs, options and crypto straight from the chart, and there is even a paper-trading option in the panel. This is the fastest route for discretionary trading. The limitation: the panel is for manual order entry — it does not automatically convert your Pine Script strategy signals into orders. For hands-off automation you still need webhooks, which is where the next two methods come in.
2. No-code webhook bridges
Services such as TradersPost receive your TradingView webhook and route it to Alpaca with no code on your side. TradersPost supports Alpaca directly; its Starter tier runs about $61.95/month (one live account, one asset class), scaling to roughly $299/month for full features. You trade a recurring fee for convenience — and you accept a third party sitting in your order path.
3. Self-hosted Python webhook relay (the free, full-control method)
A small Flask app receives the alert, verifies a secret, and submits the order through Alpaca’s API. Apart from cheap or free hosting it costs nothing, and it gives you total control over position sizing, risk checks and de-duplication. It is the same relay pattern I documented in my TradingView-to-Interactive-Brokers guide — only Alpaca’s API is simpler.
Want this built and tested for you? Message me on WhatsApp at +91 77352 68199 and I’ll set up a paper-tested TradingView-to-Alpaca relay around your exact strategy.
Building the Python webhook relay step by step
First, install the two dependencies:
pip install flask alpaca-py
Then the relay itself. Keep your keys in environment variables — never hard-code them:
from flask import Flask, request, abort
from alpaca.trading.client import TradingClient
from alpaca.trading.requests import MarketOrderRequest
from alpaca.trading.enums import OrderSide, TimeInForce
import os
app = Flask(__name__)
# Load credentials from environment variables (never hard-code keys)
API_KEY = os.environ['ALPACA_API_KEY']
API_SECRET = os.environ['ALPACA_API_SECRET']
WEBHOOK_SECRET = os.environ['WEBHOOK_SECRET'] # your own shared password
# paper=True uses https://paper-api.alpaca.markets (test here first)
client = TradingClient(API_KEY, API_SECRET, paper=True)
@app.route('/webhook', methods=['POST'])
def webhook():
data = request.get_json(force=True)
# 1) Authenticate the alert with your own shared secret
if not data or data.get('secret') != WEBHOOK_SECRET:
abort(403)
# 2) Read the fields your TradingView alert sends
symbol = data['ticker'] # e.g. AAPL
action = data['action'].lower() # buy or sell
qty = float(data.get('qty', 1))
side = OrderSide.BUY if action == 'buy' else OrderSide.SELL
# 3) Build and submit a market order
order = MarketOrderRequest(
symbol=symbol,
qty=qty,
side=side,
time_in_force=TimeInForce.DAY,
)
filled = client.submit_order(order_data=order)
return {'status': 'ok', 'id': str(filled.id)}, 200
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
Finally, paste this into your TradingView alert’s Message box and set the webhook URL to https://your-server.com/webhook:
{
"secret": "your-strong-random-string",
"ticker": "{{ticker}}",
"action": "buy",
"qty": 10
}
The flow is simple: TradingView fires the POST, your relay checks the shared secret, transforms the payload, submits the order, and returns 200 OK quickly so TradingView does not time out. While testing, expose your local machine with a tunnel such as ngrok, and keep paper=True. Only switch to a live client after a solid paper soak.
The mistakes that break live Alpaca automation
Most failed bots do not fail on the Alpaca side — they fail on the signal side:
- Repainting signals. An alert that repaints fires on a candle that later changes, producing phantom fills. Fix it before going live; see my Pine Script repainting fix.
- Wrong alert frequency. In my 8 years, the single most common “my Alpaca bot double-bought” ticket traces back to a strategy left on once per bar, firing intrabar. Switching to once per bar close fixes it more often than any code change — here is the full breakdown of once per bar vs once per bar close.
- No de-duplication. Add a cooldown or an order-id check so a re-sent webhook cannot double your position.
- Going live too early. Always soak on the paper account first.
- Weak security. Keep API keys in environment variables, validate the shared secret on every request, and serve over HTTPS.
Which method should you pick?
| Method | Cost | Coding | Best for |
|---|---|---|---|
| Built-in integration | Free (broker side) | None | Manual trading from charts |
| No-code bridge | ~$62–299/month | None | Hands-off automation, no server |
| Python relay | Free + hosting | Python | Full control & custom risk logic |
If you want a production-grade relay with proper risk controls rather than a copy-paste script, that is exactly what I do — see my Pine Script development service. US-based traders can also hire me directly for algo-trading automation.
Frequently asked questions
Is Alpaca free to use with TradingView?
Alpaca itself is free — commission-free on US stocks and ETFs, with a free paper account and no monthly platform fee. The cost sits on the TradingView side, because sending webhooks requires a paid plan (Essential from $14.95/month).
Which TradingView plan do I need for Alpaca webhooks?
Any paid plan from Essential upward supports webhook URLs on alerts, provided two-factor authentication is enabled. The free Basic plan cannot fire webhooks at all.
Can I automate TradingView alerts to Alpaca without coding?
Yes. A no-code bridge such as TradersPost connects TradingView webhooks to Alpaca for a monthly fee. For full control and no recurring cost, a self-hosted Python relay is the better long-term option.
Does Alpaca support paper trading through TradingView?
Yes. Alpaca’s paper account uses the same API as live, and TradingView’s Alpaca panel includes a paper-trading option, so you can rehearse the entire flow risk-free.
Is TradingView-to-Alpaca automation safe?
The technology is reliable, but automation amplifies mistakes. Validate your webhook secret, test on paper, add risk limits, and start with small size when you go live.
Ready to automate your US-stock strategy on Alpaca? Send your Pine Script strategy to me on WhatsApp at +91 77352 68199 for a free feasibility check and a paper-tested setup.
Risk disclaimer
Trading stocks, options and other financial instruments carries substantial risk, and you can lose more than your initial capital. Automated systems can fail, misfire or place unintended orders. Nothing here is financial advice or a guarantee of profit. Test every strategy on a paper account, understand the risks, and consult a licensed financial professional before trading live. Alpaca account features, fees and TradingView pricing were accurate to the best of my research as of July 2026 and are subject to change.

Leave a Reply