You have a strategy working on TradingView. The alerts fire correctly. Now you want it to place the order itself, without you sitting at the screen at 9:15.
This is the honest version of how that pipeline works on an Indian broker — including the parts most tutorials skip.
The architecture
TradingView cannot talk to Zerodha directly. There is no official integration, and anyone promising one-click TradingView-to-broker magic is glossing over the middle. The real chain is:
Pine Script alert → webhook → your server → Kite Connect API → order on the exchange
You need a server in the middle. That is not optional, and since 2026 it is also a regulatory requirement.
Step 1: Make the alert carry data
A plain alert is useless to a machine. The alert message must be structured so your server knows what to do:
{
"secret": "your-shared-secret",
"symbol": "NIFTY25JULFUT",
"action": "BUY",
"qty": 50,
"order_type": "MARKET"
}
In Pine Script, set this as the alert message and point the webhook URL at your server endpoint.
Step 2: The server that receives it
A minimal FastAPI receiver looks like this:
from fastapi import FastAPI, Request, HTTPException
from kiteconnect import KiteConnect
app = FastAPI()
kite = KiteConnect(api_key="your_api_key")
kite.set_access_token(load_todays_token())
@app.post("/webhook")
async def webhook(request: Request):
data = await request.json()
if data.get("secret") != MY_SECRET:
raise HTTPException(403, "forbidden")
kite.place_order(
variety=kite.VARIETY_REGULAR,
exchange=kite.EXCHANGE_NFO,
tradingsymbol=data["symbol"],
transaction_type=data["action"],
quantity=data["qty"],
order_type=kite.ORDER_TYPE_MARKET,
product=kite.PRODUCT_MIS,
)
return {"ok": True}
That secret check matters. Your webhook URL is a public endpoint. Without a shared secret, anyone who discovers it can place orders in your account.
Step 3: The static IP requirement
Since SEBI’s retail algo framework became mandatory on 1 April 2026, API orders may only originate from a static IP registered with your broker. A laptop on home broadband will not do — the IP rotates and the broker will reject the request.
In practice this means a small cloud instance with a fixed IP, whitelisted in your broker account. We explain this fully in our guide to the 2026 SEBI algo rules.
Step 4: The access token problem
This is where most first attempts fail quietly. Kite Connect access tokens expire daily. Your bot will work beautifully on day one and silently stop on day two.
You need a login routine that runs before market open each day and stores a fresh token where your webhook handler can read it. Until that is automated, you do not have automation — you have a script that works on Mondays.
The mistakes that cost money
- Duplicate alerts. TradingView can fire the same alert more than once. Without an idempotency check, you get two positions instead of one.
- Repainting strategies. If your Pine Script calculates on every tick carelessly, alerts fire on candles that later change. Your backtest looks brilliant; your live results do not match.
- No kill switch. Always have a way to flatten everything and stop the bot without SSH-ing into a server while positions move against you.
- Market orders on illiquid strikes. Slippage on a wide spread will eat an edge that looked fine in backtesting.
- No logging. When something goes wrong at 9:20, order logs are the difference between a fix and a guess.
Is it worth doing yourself?
If you enjoy the engineering, absolutely — the pipeline above is a weekend project, and you will understand your own system. Budget for the unglamorous parts: token refresh, reconnection logic, monitoring, and the first month of small bugs found with real money.
If you want the strategy trading rather than the infrastructure hobby, that is what we do.
Want your TradingView strategy automated properly — compliant static-IP deployment, token handling, monitoring and a kill switch? Get a free consultation and fixed quote from Data Genesis.