A port-80 webhook server that receives TradingView Pine Script alerts and automatically executes trades on Topstep (via Tradovate) and Lucid Markets.
TradingView Alert
│
▼ POST http://<your-server>/webhook/<token>
┌─────────────────────────────┐
│ Express Server (port 80) │
│ │
│ 1. Validate webhook token │
│ 2. Parse alert body │
│ 3. Route to broker │
│ 4. Log order result │
└────────────┬────────────────┘
│
┌───────┴────────┐
▼ ▼
Topstep Lucid Markets
(Tradovate API) (REST API)
git clone <repo-url>
cd App
npm installcp .env.example .env
# Edit .env with your settings
nano .env# Production
sudo npm start # needs sudo for port 80
# Development (auto-reload)
sudo npx nodemon src/server.jsPOST /auth/register
Content-Type: application/json
{
"username": "alice",
"email": "alice@example.com",
"password": "securePass123"
}
POST /auth/login
Content-Type: application/json
{
"email": "alice@example.com",
"password": "securePass123"
}
→ { "token": "eyJ..." }
POST /webhooks
Authorization: Bearer <token>
Content-Type: application/json
{
"label": "My ES Strategy",
"broker": "topstep",
"brokerConfig": {
"username": "tradovate_user",
"password": "tradovate_pass",
"appId": "your_app_id",
"accountId": 123456,
"sim": false
}
}
Response includes your unique webhook URL to paste into TradingView:
{
"webhook": {
"webhookUrl": "http://your-server/webhook/abc123def456...",
"tradingViewSetup": {
"alertMessageFormat": {
"action": "{{strategy.order.action}}",
"ticker": "{{ticker}}",
"price": "{{close}}",
"qty": "{{strategy.order.contracts}}",
"comment": "{{strategy.order.comment}}"
}
}
}
}GET /webhooks
Authorization: Bearer <token>
PUT /webhooks/:id
Authorization: Bearer <token>
{ "active": false } ← disable without deleting
DELETE /webhooks/:id
Authorization: Bearer <token>
POST /webhook/<token>
Content-Type: application/json
{
"action": "buy",
"ticker": "ESH2026",
"price": 5250.00,
"qty": 1
}
Also accepts plain text: "buy ES 1"
GET /user/me ← profile
GET /user/orders ← order history (add ?limit=50)
- Open TradingView → Create or edit a strategy alert
- In Notifications, enable Webhook URL
- Paste your webhook URL:
http://your-server/webhook/<token> - In the Alert message body, paste:
{
"action": "{{strategy.order.action}}",
"ticker": "{{ticker}}",
"price": {{close}},
"qty": {{strategy.order.contracts}},
"comment": "{{strategy.order.comment}}"
}- Save the alert. Every time the strategy fires, the trade executes automatically.
| Key | Description |
|---|---|
username |
Tradovate login username |
password |
Tradovate login password |
appId |
App ID from Tradovate developer portal |
accountId |
Numeric account ID |
sim |
true for demo server, false for live |
Get your App ID at: https://trader.tradovate.com → Settings → API Access
| Key | Description |
|---|---|
apiKey |
Lucid API key |
apiSecret |
Lucid API secret (used for HMAC request signing) |
accountId |
Your Lucid account ID |
| Field | TradingView Variable | Example |
|---|---|---|
action |
{{strategy.order.action}} |
"buy" / "sell" |
ticker |
{{ticker}} |
"ESH2026" |
price |
{{close}} |
5250.00 |
qty |
{{strategy.order.contracts}} |
2 |
comment |
{{strategy.order.comment}} |
"EMA Crossover" |
Also accepted: long / short / close / flat / exit as action values.
GET /health
→ { "status": "ok", "uptime": 123.4 }