Vector Trading Webhooks Integration Guide
Welcome to Vector Trading's webhook integration! This comprehensive guide will help you connect your TradingView strategies with our trading platform using webhooks.
The Vector Trading webhook API supports various types of signals, including position opening, position management, and strategy management. We also provide best practices to ensure the security and optimization of your trading strategies.
The API is flexible and not limited to TradingView only. You can use it with any other platforms that support sending HTTP POST requests in a JSON format.
What are TradingView Webhooks?
TradingView webhooks allow you to send automated trading signals from your Pine Script strategies directly to Vector Trading platform. When your strategy conditions are met, TradingView will send a JSON payload to our webhook endpoint, which will then execute the corresponding trading action on your connected exchange.
Setting Up Your Trading Bot
Create a Trading Bot
- Go to the Vector Trading terminal in the "Trading" section of the main menu
- Connect the required exchange account (for example, BingX, Bybit, etc.)
- Click "+ Create Bot"
- Choose a name for your algorithm
- Configure the bot parameters:
- Trading limits: Set limits for position size and total capital
- Entries: Set entries for the bot, and offsets if you do not want the bot to use entries from TradingView signals
- Take-profits: Set take-profit levels for automatic profit locking if you do not want the bot to use take-profits from TradingView signals
- Stop-loss: Set a stop-loss level to protect capital if you do not want the bot to use stop-loss from TradingView signals
Get Your Webhook URL
After creating your bot, you'll receive a unique webhook URL that looks like:
https://www.vector-trading.app/webhooks/signals/v1/YOUR_BOT_API_KEY
Market Order
The simplest order type that executes immediately at current market price. For market orders, do not specify or fields.
Basic Market Order
{"version": 1.0,"action": "open","marketPrice": {{close}},"order": {"side": "buy"},"timestamp": "{{timenow}}","hashtag": "LONG_BTCUSDT_20250214010200_15M"}
Simplest market order without additional parameters. Executes immediately at current market price.
Limit Order
Limit orders execute only at specified price or better. Specify the field to create a limit order.
Basic Limit Order
{"version": 1.0,"action": "open","marketPrice": {{close}},"order": {"side": "buy","price": {{close * 0.998}}},"timestamp": "{{timenow}}","hashtag": "LONG_BTCUSDT_20250214010200_15M"}
Limit order with specified execution price. Will execute only at specified price or better.
Trigger Order
Trigger orders activate when trigger price is reached. Specify the field. Optionally add field for limit trigger order.
Basic Trigger Order
{"version": 1.0,"action": "open","marketPrice": {{close}},"order": {"side": "buy","triggerPrice": {{close * 1.01}}},"timestamp": "{{timenow}}","hashtag": "LONG_BTCUSDT_20250214010200_15M"}
Trigger order activates when specified price is reached and executes at market.
Force Order
If you want to guarantee closing all existing positions and orders before opening a new position (reliable reversal), use the flag. This is especially useful for strategies that require complete exit from current position before entering the opposite one.
Example: Force Close and Open New Position
{"version": 1.0,"action": "open","force": true,"marketPrice": {{close}},"order": {"side": "buy"},"timestamp": "{{timenow}}","hashtag": "LONG_BTCUSDT_20250214010200_15M"}
Force flag behavior:
- - first close ALL positions and cancel ALL orders for the trading pair, then create a new order
- or absent - check available bot limit, ignore signal if there are positions from other bots, create order for available remainder
Update Signal
Use to modify existing trading state without opening a new position.
- If position is already open, works as trailing stop and updates active stop-loss order.
- If position is not open but entry order exists, changes pending entry / and stop-loss value.
Trailing Stop for Open Position
{"version": 1.0,"action": "update","marketPrice": {{close}},"order": {"side": "sell","stop": {{close * 0.985}}},"timestamp": "{{timenow}}","hashtag": "LONG_BTCUSDT_20250214010200_15M"}
Update Pending Entry and Stop-Loss
{"version": 1.0,"action": "update","marketPrice": {{close}},"order": {"side": "buy","price": {{close * 0.997}},"triggerPrice": {{close * 1.003}},"stop": {{close * 0.96}}},"timestamp": "{{timenow}}","hashtag": "LONG_BTCUSDT_20250214010200_15M"}
Important: For only , , and are supported for updates. Other fields are ignored by the handler.
Position Management
Cancel All Open Orders
{"version": 1.0,"action": "cancel","marketPrice": {{close}},"timestamp": "{{timenow}}","hashtag": "LONG_BTCUSDT_20250214010200_15M"}
Close All Positions
{"version": 1.0,"action": "close","marketPrice": {{close}},"timestamp": "{{timenow}}","hashtag": "LONG_BTCUSDT_20250214010200_15M"}
Strategy Control
Start Trading Strategy
{"version": 1.0,"action": "start","marketPrice": {{close}},"timestamp": "{{timenow}}","hashtag": "LONG_BTCUSDT_20250214010200_15M"}
Pause Trading Strategy
{"version": 1.0,"action": "pause","marketPrice": {{close}},"timestamp": "{{timenow}}","hashtag": "LONG_BTCUSDT_20250214010200_15M"}
Webhook Payload Structure
Required Fields
| Field | Type | Description |
|---|---|---|
| Number | Your TradingView strategy version (for tracking performance of different versions) | |
| String | Action to perform: , , , , , | |
| Number | Current market price when signal was triggered | |
| String | Signal timestamp (use for current time) | |
| Boolean | Force close all positions/orders before opening (only for ) |
Optional Order Fields
| Field | Type | Description |
|---|---|---|
| String | Order direction: or | |
| Number | Execution price (for limit orders) | |
| Number | Trigger price (for trigger orders) | |
| Number | Stop-loss price | |
| Number | Percentage of available balance to use (1-100) | |
| Array | Take-profit targets with price and percentage | |
| String | Hashtag for telegram notifications to group related position events (open + take profits) |
Note: Order type is automatically determined based on the presence of and fields.
For only , , and are applied.
Take-Profit Structure
"takeProfits": [{"price": 50000.00, "percent": 30},{"price": 55000.00, "percent": 40},{"price": 60000.00, "percent": 30}]
TradingView Configuration
Setting Up Alerts
- Open your TradingView chart
- Apply your Pine Script strategy
- Click the "Alert" button (clock icon)
- Configure alert conditions:
- Condition: Select your strategy
- Options: Choose "Once Per Bar Close" for most strategies
- Expiration: Set appropriate expiration time
Webhook Configuration
- In the alert dialog, go to the "Notifications" tab
- Check "Webhook URL"
- Paste your Vector Trading webhook URL
- In the "Message" field, paste your JSON payload
Using TradingView Variables
You can use TradingView's built-in variables in your JSON:
- - Current close price
- - Current open price
- - Current high price
- - Current low price
- - Current volume
- - Current timestamp
- - Strategy action (buy/sell)
- - Current position size
Dynamic Price Calculation Example:
{"version": 1.0,"action": "open","marketPrice": {{close}},"order": {"side": "buy","orderType": "limit","price": {{close * 0.998}},"stop": {{close * 0.96}},"takeProfits": [{"price": {{close * 1.04}}, "percent": 50},{"price": {{close * 1.08}}, "percent": 50}]},"timestamp": "{{timenow}}","hashtag": "LONG_BTCUSDT_20250214010200_15M"}
Best Practices
Security Recommendations
- Never publish your webhook URL publicly
- Use unique hashtags for each strategy to avoid conflicts
- Monitor your alerts regularly to ensure they're working correctly
- Test thoroughly on demo accounts before live trading
Strategy Optimization
- Start with small position sizes when testing webhook integration
- Use appropriate timeframes for your strategy
- Set reasonable stop-losses to protect capital
- Monitor performance and adjust parameters as needed
Error Handling
- Check webhook logs in the Vector Trading dashboard
- Validate JSON syntax using online JSON validators
- Ensure all required fields are present in your payload
- Contact support for persistent issues
Conclusion
TradingView webhook integration with Vector Trading opens powerful possibilities for trading automation. Follow this guide and best practices for successful implementation of your trading strategies.