Signal Syntax
The complete reference for every field a TradeHookX signal accepts. Signals are JSON in your TradingView alert message; A compact plain-text format is also accepted. The Alert Builder generates all of this for you - this page is for when you want full control.
The two-minute workflow
You rarely need to write any of this by hand. Build the alert visually in the Alert Builder, hit Get JSON, and paste the output into your TradingView alert message - that is the entire workflow. The reference below is for understanding and fine-tuning what it generates.

Get JSON on an alert template
Required fields
| Field | Values | Description |
|---|---|---|
| licenseKey | string | Your license key from the dashboard. license_key and api_key are accepted aliases. |
| action | see below | What to do. Defaults to strategy mode when omitted. |
| symbol | e.g. EURUSD | Instrument to trade (case-insensitive). Optional only for closeall. Symbol mapping translates it per terminal. |
{ "licenseKey": "TB-XXXX-XXXX-XXXX", "action": "buy", "symbol": "EURUSD" }Actions
| Action | Type | Description |
|---|---|---|
| buy / sell | market | Open a market position. |
| buylimit / selllimit | pending | Place a limit order. |
| buystop / sellstop | pending | Place a stop order. |
| closelong / closeshort | close | Close open long or short positions on the symbol. |
| closelongpct / closeshortpct | close | Close a percentage of the position (with close_percent). |
| closelongvol / closeshortvol | close | Close a fixed volume of the position. |
| closeall | close | Close every open position (symbol optional). |
| cancel | pending | Cancel pending orders on the symbol. |
| newsltplong / newsltpshort | modify | Set a new SL/TP on an open long or short position. |
| strategy | dynamic | Use TradingView strategy placeholders - the action comes from your Pine strategy at runtime. |
{
"licenseKey": "TB-XXXX-XXXX-XXXX",
"action": "{{strategy.order.action}}",
"symbol": "{{ticker}}",
"size": "{{strategy.order.contracts}}", "size_type": "units"
}Position sizing
| Field | Values | Description |
|---|---|---|
| size | number | Position size. lots is an accepted alias. |
| size_type | units | percentage | risk | How size is interpreted: fixed lots, % of balance, or risk-based sizing. |
| risk | number | Risk percentage for risk-based sizing (used with a stop loss). |
Stop loss and take profit
| Field | Values | Description |
|---|---|---|
| sl / tp | number | Stop loss / take profit value. |
| sl_type / tp_type | price_distance | points_distance | percentage_distance | fixed_price | How the value is measured. Default: price_distance. |
{ "licenseKey": "TB-XXXX", "action": "buy", "symbol": "EURUSD", "size": 0.1, "sl": 20, "tp": 40 }Multiple take profits
Split one position across up to three TP levels with partial closes, and move the stop to breakeven as levels hit.
| Field | Values | Description |
|---|---|---|
| tp1 / tp2 / tp3 | number | Take profit levels (same measurement as tp_type). |
| tp1_size / tp2_size / tp3_size | percent | Portion of the position to close at each level. |
| tp1_lots / tp2_lots / tp3_lots | lots | Alternative: close a fixed lot amount at each level. |
| be_after_tp1 / be_after_tp2 | true | Move stop loss to breakeven after TP1 or TP2 fills. |
{
"licenseKey": "TB-XXXX", "action": "buy", "symbol": "XAUUSD", "size": 0.3,
"sl": 50, "tp1": 30, "tp1_size": 33, "tp2": 60, "tp2_size": 33, "tp3": 90, "tp3_size": 34,
"be_after_tp1": true
}Breakeven and trailing stop
| Field | Values | Description |
|---|---|---|
| breakeven_trigger | number | Profit distance that arms the breakeven move. |
| breakeven_offset | number | Points beyond entry to place the stop (default 2). |
| trailing_stop | number | Trailing distance in points. |
| trailing_step | number | Minimum move before the stop updates (default 5). |
| trailing_activation | number | Profit distance before trailing begins. |
Behavior and routing
| Field | Values | Description |
|---|---|---|
| execution_mode | mt_native | close_opposite | flip | mt_native places the order as-is; close_opposite closes opposing positions first; flip reverses the position. |
| strategy | 3 characters | Strategy tag (uppercased). Terminals configured with a tag only execute matching signals - run multiple strategies on one account in isolation. |
| magic | integer | Magic number for order identification in MetaTrader. |
| comment | string (100 max) | Order comment visible in MetaTrader. |
| close_percent | 1-99 | With close actions: close only this percentage of the position. |
| tv_username | string | Your bound TradingView username - required when TradingView binding is enabled. The Alert Builder adds it automatically. |
Plain-text signals
Prefer not to use JSON? The webhook also accepts a compact comma-separated format. The first three parts are always license key, action, and symbol, followed by any number of key=value parameters:
TB-XXXX-XXXX-XXXX,buy,EURUSD,sl=20,tp=40,risk=1Numeric keys (sl, tp, risk, lots, size, price, breakeven) are parsed as numbers; other keys such as strategy, comment, and tv_username pass through as text. JSON remains the recommended format - it covers every field on this page and is what the Alert Builder generates.
Do not hand-write what the Alert Builder can generate
Every field on this page maps to a control in the Alert Builder. Build the alert there, copy the JSON, and use this page to understand or fine-tune it.