Documentation
Webhook API
Send JSON alerts from TradingView (or any HTTP client) to route order and position-management payloads to your linked cTrader account via the Open API.
Deliver market or limit order JSON with size, SL/TP, and optional label.
Close open positions filtered by label, symbol, or side.
Move stop loss or take profit on positions matched by label.
Endpoint
https://cwebhook.com/alerts
Content-Type: application/json
Body: JSON object. Your account is identified by the key field (from your Cwebhook dashboard).
Legacy URL https://alerts.cwebhook.com remains supported; new integrations should use /alerts on the main domain.
Labels — tie alerts to positions
Use the same label on entry, close, and modify alerts.
When you open a trade, set "label": "my-strategy". Later webhooks with
closePosition or modifyPosition and that label only affect those positions.
- Entry alert → include
label - Breakeven / trail / TP change →
modifyPosition: true+ same label - Exit alert →
closePosition: true+ same label
Open market order
Default flow when neither closePosition nor modifyPosition is set.
Required fields
key, symbolId, tradeSide (1 = buy, 2 = sell), volumeType (1 = fixed lots, 2 = % balance), volume or volumePercent, relativeStopLoss, relativeTakeProfit, trailingStopLoss
{
"key": "YOUR_CWEBHOOK_KEY",
"symbolId": 1,
"tradeSide": 1,
"relativeTakeProfit": 20,
"relativeStopLoss": 10,
"trailingStopLoss": false,
"volumeType": 1,
"volume": 1,
"label": "tv-strategy-01",
"closeOpenPosition": false
}
Set relativeStopLoss / relativeTakeProfit to 0 to omit. Limit orders: use limitOrder: true and limitPrice (see dashboard alert generator).
Close positions
Closes matching open positions without opening a new trade.
{
"key": "YOUR_CWEBHOOK_KEY",
"closePosition": true,
"label": "tv-strategy-01"
}
Optional filters: symbolId, tradeSide. Omit them to close all positions matching the label. Use closePercent (1–100) to close part of each matched position; omit it to close 100%.
⚠ No label = all positions. If you omit label, closePosition closes every open position on the account (filtered only by symbolId / tradeSide if provided). This includes positions opened manually in cTrader. Always set a label if you have manual trades or run multiple strategies.
{
"key": "YOUR_CWEBHOOK_KEY",
"closePosition": true,
"label": "tv-strategy-01",
"closePercent": 50
}
Modify stops on open positions
New
After a position is open, send a webhook to move stop loss or take profit without closing the trade.
Requires label matching the entry alert.
| Goal | Fields |
|---|---|
| Breakeven | stopLossMode: "breakeven" |
| Breakeven + lock-in pips | stopLossMode: "breakeven", breakevenOffsetPips: 2 |
| SL / TP in pips from entry | stopLossPips, takeProfitPips |
| SL / TP at absolute price | stopLoss, takeProfit |
| Trailing stop | Set SL fields above + trailingStopLoss: true |
Examples
{
"key": "YOUR_CWEBHOOK_KEY",
"closePosition": true,
"modifyPosition": true,
"label": "tv-strategy-01",
"closePercent": 50,
"stopLossMode": "breakeven"
}
{
"key": "YOUR_CWEBHOOK_KEY",
"modifyPosition": true,
"label": "tv-strategy-01",
"stopLossMode": "breakeven"
}
{
"key": "YOUR_CWEBHOOK_KEY",
"modifyPosition": true,
"label": "tv-strategy-01",
"stopLossPips": 15,
"takeProfitPips": 30
}
{
"key": "YOUR_CWEBHOOK_KEY",
"modifyPosition": true,
"label": "tv-strategy-01",
"stopLossPips": 15,
"trailingStopLoss": true
}
{
"key": "YOUR_CWEBHOOK_KEY",
"modifyPosition": true,
"label": "tv-strategy-01",
"stopLoss": 1.085,
"takeProfit": 1.095
}
- At least one stop or take profit field must be provided when
modifyPositionis true. closePercentcloses that share of each matched position (rounded to the symbol’s lot step). Required whenclosePositionandmodifyPositionare both true; must be less than 100 in that case. Existing take profit on the remainder is preserved when you only change stop loss (e.g. breakeven).relativeStopLoss/slare for new orders only — usestopLossPips(orstopLoss) whenmodifyPositionis true.- All open positions with the same label are updated (use
symbolId/tradeSideto narrow). - If no position matches, the webhook is rejected.
Field reference
| Field | Type | When | Description |
|---|
Errors & limits
HTTP responses
200— Accepted and queued400— Invalid key, JSON, or payload429— Rate limit or trading window503— Temporary server issue
Rate limits (typical)
- Demo: 30/min, 100/day
- Live: 120/min
- Valid JSON can still be rejected if limits or account status fail.
TradingView setup
- Create an alert on your strategy or chart.
- Enable Webhook URL and paste
https://cwebhook.com/alerts. - In the message box, paste JSON from your Cwebhook dashboard alert generator, or build payloads from the examples above.
- Use a consistent
labelper strategy so close and modify alerts target the right positions. - Test on demo before live — check the activity log in your dashboard for status and errors.