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

Get JSON on an alert template

Required fields

FieldValuesDescription
licenseKeystringYour license key from the dashboard. license_key and api_key are accepted aliases.
actionsee belowWhat to do. Defaults to strategy mode when omitted.
symbole.g. EURUSDInstrument to trade (case-insensitive). Optional only for closeall. Symbol mapping translates it per terminal.
minimal signal
{ "licenseKey": "TB-XXXX-XXXX-XXXX", "action": "buy", "symbol": "EURUSD" }

Actions

ActionTypeDescription
buy / sellmarketOpen a market position.
buylimit / selllimitpendingPlace a limit order.
buystop / sellstoppendingPlace a stop order.
closelong / closeshortcloseClose open long or short positions on the symbol.
closelongpct / closeshortpctcloseClose a percentage of the position (with close_percent).
closelongvol / closeshortvolcloseClose a fixed volume of the position.
closeallcloseClose every open position (symbol optional).
cancelpendingCancel pending orders on the symbol.
newsltplong / newsltpshortmodifySet a new SL/TP on an open long or short position.
strategydynamicUse TradingView strategy placeholders - the action comes from your Pine strategy at runtime.
strategy mode (dynamic - works for entries and exits from one alert)
{
  "licenseKey": "TB-XXXX-XXXX-XXXX",
  "action": "{{strategy.order.action}}",
  "symbol": "{{ticker}}",
  "size": "{{strategy.order.contracts}}", "size_type": "units"
}

Position sizing

FieldValuesDescription
sizenumberPosition size. lots is an accepted alias.
size_typeunits | percentage | riskHow size is interpreted: fixed lots, % of balance, or risk-based sizing.
risknumberRisk percentage for risk-based sizing (used with a stop loss).

Stop loss and take profit

FieldValuesDescription
sl / tpnumberStop loss / take profit value.
sl_type / tp_typeprice_distance | points_distance | percentage_distance | fixed_priceHow the value is measured. Default: price_distance.
buy with SL/TP
{ "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.

FieldValuesDescription
tp1 / tp2 / tp3numberTake profit levels (same measurement as tp_type).
tp1_size / tp2_size / tp3_sizepercentPortion of the position to close at each level.
tp1_lots / tp2_lots / tp3_lotslotsAlternative: close a fixed lot amount at each level.
be_after_tp1 / be_after_tp2trueMove stop loss to breakeven after TP1 or TP2 fills.
multi-TP with breakeven
{
  "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

FieldValuesDescription
breakeven_triggernumberProfit distance that arms the breakeven move.
breakeven_offsetnumberPoints beyond entry to place the stop (default 2).
trailing_stopnumberTrailing distance in points.
trailing_stepnumberMinimum move before the stop updates (default 5).
trailing_activationnumberProfit distance before trailing begins.

Behavior and routing

FieldValuesDescription
execution_modemt_native | close_opposite | flipmt_native places the order as-is; close_opposite closes opposing positions first; flip reverses the position.
strategy3 charactersStrategy tag (uppercased). Terminals configured with a tag only execute matching signals - run multiple strategies on one account in isolation.
magicintegerMagic number for order identification in MetaTrader.
commentstring (100 max)Order comment visible in MetaTrader.
close_percent1-99With close actions: close only this percentage of the position.
tv_usernamestringYour 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:

text signal
TB-XXXX-XXXX-XXXX,buy,EURUSD,sl=20,tp=40,risk=1

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