Webhook Signal Documentation
Learn how to send trading signals to StratOne.ai from external sources like TradingView, custom scripts, or other trading platforms.
Overview
StratOne.ai webhooks allow you to send trading signals from external sources to automatically execute trades on your connected broker accounts. This is perfect for integrating with TradingView strategies, custom algorithms, or other trading platforms.
Webhook Endpoint
POST /api/webhooks/{webhookToken}Authentication
No signature required - keep URL private
Required Headers
Content-Typeapplication/jsonSecurity Notice
No signature verification is required, but you must keep your webhook URL private. Anyone with access to this URL can send signals to your strategy.
Signal JSON Format
TradingView Standard Format
Buy Signal Example
{
"ticker": "AAPL",
"action": "buy",
"orderType": "market",
"price": 150.25,
"quantity": 100
}Required Fields
- tickerStock symbol in uppercase (e.g., "AAPL", "TSLA")
- actionTrade direction: "buy", "sell", "short", "cover"
- priceEntry or exit price for the trade (number)
Optional Fields
- quantityNumber of shares (defaults to 100)
- orderTypeOrder type: "market", "limit", "stop" (defaults to "market")
Trade Directions
"buy"
Open long position - Buy shares
"sell"
Close long position - Sell shares
Example Signals
Buy Signal
Buy Signal Example
{
"ticker": "AAPL",
"action": "buy",
"orderType": "market",
"price": 150.25,
"quantity": 100
}Sell Signal
Sell Signal Example
{
"ticker": "TSLA",
"action": "sell",
"orderType": "market",
"price": 250.75,
"quantity": 50
}cURL Example
cURL Command
curl -X POST "https://your-domain.com/api/webhooks/tradingview/YOUR_WEBHOOK_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ticker": "AAPL",
"action": "buy",
"orderType": "market",
"price": 150.25,
"quantity": 100
}'TradingView Pine Script Integration
Here's how to integrate StratOne.ai webhooks into your TradingView Pine Script strategy:
Pine Script Example
//@version=5
strategy("StratOne.ai Webhook Integration", overlay=true)
// Webhook configuration
webhook_url = "https://your-domain.com/api/webhooks/YOUR_WEBHOOK_TOKEN"
// Function to send webhook (TradingView Standard Format)
sendWebhook(action, price, quantity) =>
webhook.send(webhook_url, {
"ticker": syminfo.ticker,
"action": action,
"orderType": "market",
"price": price,
"quantity": quantity
})
// Example strategy conditions
sma20 = ta.sma(close, 20)
sma50 = ta.sma(close, 50)
// Buy condition
buy_condition = ta.crossover(sma20, sma50)
if buy_condition
sendWebhook("buy", close, 100)
// Sell condition
sell_condition = ta.crossunder(sma20, sma50)
if sell_condition
sendWebhook("sell", close, 100)
// ⚠️ SECURITY WARNING: Keep your webhook URL private!
// Do not share this URL with others as it can be used to send signals to your strategy.Response Format
Success Response
Success Response
{
"success": true,
"signalId": "cmf6k5j9c00035huw17q1pv6s",
"message": "Signal processed successfully"
}Error Response
Error Response
{
"error": "Invalid signal data",
"statusCode": 400
}Error Codes
| Code | Description |
|---|---|
| 400 | Invalid signal data, strategy inactive, or signal receiving paused |
| 403 | Strategy does not accept webhook signals (LLM-generated strategies) |
| 404 | Webhook token not found or strategy not found |
| 429 | Signal rate limit exceeded |
| 500 | Internal server error |
Best Practices
Security
- Always include the webhook signature for security
- Keep your webhook secret secure and don't share it
- Use HTTPS endpoints in production
Data Quality
- Use uppercase symbols (e.g., "AAPL" not "aapl")
- Include confidence levels to help with signal strength calculation
- Use appropriate quantities based on your strategy's position sizing
Testing Your Webhook
Before deploying to production, make sure to test your webhook integration:
- Generate your webhook URL and secret from the strategy settings
- Test with a simple cURL command or script
- Verify the signal appears in your account's order history
- Check that trades are executed correctly on your connected broker
- Monitor for any error responses and adjust accordingly
Need Help?
If you need assistance with webhook integration or have questions about the signal format, please contact our support team.
Contact Support