Cwebhook

Documentation

Webhook API

Send JSON alerts from TradingView (or any HTTP client) to execute trades and manage open positions on your linked cTrader account.

Open

Place market or limit orders with size, SL/TP, and optional label.

Close

Close open positions filtered by label, symbol, or side.

Modify

Move stop loss or take profit on positions matched by label.

Endpoint

POST 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.

  1. Entry alert → include label
  2. Breakeven / trail / TP change → modifyPosition: true + same label
  3. 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

Example — open with label
{
  "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.

Example — close by label
{
  "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%.

Example — partial close (50%)
{
  "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.

GoalFields
BreakevenstopLossMode: "breakeven"
Breakeven + lock-in pipsstopLossMode: "breakeven", breakevenOffsetPips: 2
SL / TP in pips from entrystopLossPips, takeProfitPips
SL / TP at absolute pricestopLoss, takeProfit
Trailing stopSet SL fields above + trailingStopLoss: true

Examples

Partial profit + breakeven (combined)
{
  "key": "YOUR_CWEBHOOK_KEY",
  "closePosition": true,
  "modifyPosition": true,
  "label": "tv-strategy-01",
  "closePercent": 50,
  "stopLossMode": "breakeven"
}
Breakeven
{
  "key": "YOUR_CWEBHOOK_KEY",
  "modifyPosition": true,
  "label": "tv-strategy-01",
  "stopLossMode": "breakeven"
}
Pips from entry
{
  "key": "YOUR_CWEBHOOK_KEY",
  "modifyPosition": true,
  "label": "tv-strategy-01",
  "stopLossPips": 15,
  "takeProfitPips": 30
}
Pips + trailing stop
{
  "key": "YOUR_CWEBHOOK_KEY",
  "modifyPosition": true,
  "label": "tv-strategy-01",
  "stopLossPips": 15,
  "trailingStopLoss": true
}
Absolute prices
{
  "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 modifyPosition is true.
  • closePercent closes that share of each matched position (rounded to the symbol’s lot step). Required when closePosition and modifyPosition are 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 / sl are for new orders only — use stopLossPips (or stopLoss) when modifyPosition is true.
  • All open positions with the same label are updated (use symbolId / tradeSide to narrow).
  • If no position matches, the webhook is rejected.

Field reference

Field Type When Description

Errors & limits

HTTP responses

  • 200 — Accepted and queued
  • 400 — Invalid key, JSON, or payload
  • 429 — Rate limit or trading window
  • 503 — 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

  1. Create an alert on your strategy or chart.
  2. Enable Webhook URL and paste https://cwebhook.com/alerts.
  3. In the message box, paste JSON from your Cwebhook dashboard alert generator, or build payloads from the examples above.
  4. Use a consistent label per strategy so close and modify alerts target the right positions.
  5. Test on demo before live — check the activity log in your dashboard for status and errors.