# TradeCommand - full specification > Canonical specification of the TradeCommand JSON payload, kept in sync with the live schema on every release. > Source of truth for LLM tools (ChatGPT, Claude, etc.) consuming the TV-Hub webhook spec. Total properties: 84 ## Required properties Every TradeCommand MUST include ALL FOUR of these: `exchange`, `pair`, `token`, and `apiKey`. `token` and `apiKey` are different fields and both are always required: `token` authenticates you (who you are, a password-like GUID), while `apiKey` selects which exchange account/credentials the order runs on. Sending only `token` is incomplete and the trade is rejected. ### exchange (string) Required: yes Description: Target exchange identifier. Determines which exchange receives the trade. Lowercase, hyphenated. Allowed values: binance, binance-futures, binance-futures-testnet, binance-futures-coin, binance-futures-coin-testnet, bybit, bybit-testnet, bybit-spot, bybit-spot-testnet, okx, kucoin, kucoin-spot, coinbase, coinbase-spot, bitmex, bitmex-testnet Example: binance-futures Gotcha: Lowercase only. Spot vs derivatives are distinct exchanges - picking the wrong slug routes to the wrong adapter and the trade silently misses the intended market. See also: pair, apiKey, token ### pair (string) Required: yes Description: Trading pair in exchange-native format. Each exchange has its own naming rules (e.g. `BTCUSDT` for Binance, `BTC-USDT-SWAP` for OKX, `XBTUSD` for BitMEX). Example: BTCUSDT Gotcha: TVH does not normalise pair names across exchanges. Use the exact symbol the exchange API expects, otherwise the order is rejected with 'invalid symbol'. See also: exchange, instrumentType ### token (string) Required: yes Description: Your TVH User Token, a GUID that authenticates the webhook caller (who you are). Treat as a password. Always required, and distinct from `apiKey`: `token` says who you are, `apiKey` says which exchange account to trade on. Every payload needs both. Example: YOUR_TOKEN Gotcha: Never log or share. Rotate immediately if leaked - every account inherits trading authority through this single value. See also: apiKey ### apiKey (string) Required: yes Description: Name of the exchange API key registered in your TVH dashboard. Always required, and distinct from `token`: `token` authenticates you, `apiKey` selects which exchange account/credentials the order runs on. Routes the order to the correct credentials. Do not omit it even when `token` is present. Example: binance-main Gotcha: Must match the `Name` you set when adding the API key - not the exchange-issued key itself. Case-sensitive. See also: exchange, token ## Category: core ### isBuy (bool) Required: conditional Default: false Description: Marks the signal as a long entry. Use this for normal webhook/manual TradeCommands. Mutually exclusive with `isSell` and `isClose`. Example: true See also: isSell, isClose, orderType ### isSell (bool) Required: conditional Default: false Description: Marks the signal as a short/ sell entry. Use this for normal webhook/manual TradeCommands. Mutually exclusive with `isBuy` and `isClose`. Example: true See also: isBuy, isClose, orderType ### isMarket (bool) Required: no Default: false Description: Sends a market order. When `false` (and `isLimit` is true) TVH uses the `price` field as a limit price. Example: true See also: isLimit, price, orderType ### isClose (bool) Required: conditional Default: false Description: Marks the signal as a close-only action. Combined with `closeLong` / `closeShort` for hedge-mode flat commands. Example: true Gotcha: Auto-set when `orderType` is `"close"` or when `strategyComment` matches a close token. See `02-trade-command/gotchas.mdx`. See also: closeLong, closeShort, useLimitClose, orderType ### isLimit (bool) Required: no Default: false Description: Sends a limit order at `price`. Ignored when `isMarket` is true. Example: true See also: isMarket, price, limitPriceType ### isStopLoss (bool) Required: no Default: false Description: Marks the signal as a standalone stop-loss order (not an entry with attached SL). Used to add an SL to an existing position. Example: true See also: stopLoss, stopLossPercent, stopLossType ### price (decimal) Required: conditional Default: 0 Description: Limit price for non-market orders. Also the reference price for absolute stop-loss / take-profit calculations. Example: 65250.5 See also: isLimit, limitPriceType, stopLoss, targets ### orderType (string) Required: conditional Description: TradingView strategy-alert direction field. Use `orderType` when mapping `{{strategy.order.action}}`; for normal webhook/manual TradeCommands use `isBuy: true`, `isSell: true`, or `isClose: true`. Allowed values: buy, sell, close Example: buy Gotcha: Do not use `orderType: "buy"` / `"sell"` in basic manual examples. Those belong to TradingView strategy-alert templates; normal webhook payloads should set `isBuy` or `isSell`. See also: isBuy, isSell, isClose, strategyComment, strategyCloseValue ### strategyComment (string) Required: no Description: Mirrors TradingView's `strategy.entry/exit(..., comment=...)`. TVH inspects the string for close tokens (`close`, `exit`, `flat`) to auto-trigger an exit, or for custom tokens listed in `strategyCloseValue`. Example: Long Exit TP1 Gotcha: Substring match is case-insensitive. Avoid the word `close` in entry comments unless you actually want them to exit. See also: strategyCloseValue, orderType, isClose ### broadcastSignal (string) Required: no Description: Name of the signal source to broadcast this trade to. Copy-trade followers of this source mirror the trade. Empty = no broadcast. Example: alpha-scalper See also: apiKey ### strategyCloseValue (string) Required: no Description: Additional close token (or pipe-separated list) matched as a substring inside `strategyComment`, on top of the built-in `close`/`exit`/`flat` scan. It adds triggers, it does not replace the built-in ones. Example: `"TP|SL|FLATTEN"`. Example: close|exit|flat See also: strategyComment, orderType ## Category: sizing ### units (decimal) Required: conditional Default: 0 Description: Position size in the unit selected by `unitsType` (absolute base-asset quantity, percent of balance, or risk-based). `units` is never a quote-currency / dollar amount. To enter a fixed quote amount such as 250 USDT, do NOT put 250 here: set `useFixedSize: true` and `fixedQuoteSize: 250` instead. Example: 0.05 See also: unitsType, unitsPercent, useFixedSize, fixedQuoteSize ### unitsType (string) Required: no Default: absolute Description: How to interpret `units`. `absolute` = base-asset quantity, `percent` = percent of available margin/balance, `percentBalance` = percent of total balance, `percentWallet` = percent of wallet equity, `percentPosition` = percent of current open position (close/scale-out only), `risk` = derive size from `stopLoss` distance. There is no quote-currency value: for a fixed quote amount (e.g. 250 USDT / $250) use `useFixedSize: true` + `fixedQuoteSize`, not `unitsType`. `unitsType: "quote"` does not exist. Allowed values: absolute, percent, percentBalance, percentWallet, percentPosition, risk Example: percent Gotcha: `risk` mode requires `stopLoss` (absolute) or `stopLossPercent` to be set, otherwise TVH cannot back-solve the size and rejects the trade. `percentPosition` only makes sense on close / scale-out payloads - there is no entry position to take a percent of. See also: units, unitsPercent, stopLoss, stopLossPercent ### unitsPercent (decimal) Required: no Default: 0 Description: Convenience field equivalent to `units` when `unitsType="percent"`. Provided as a separate property so Pine alert messages can hard-code a percentage without flipping the type flag. Example: 5 See also: units, unitsType ### useFixedSize (bool) Required: no Default: false Description: Set true to size the entry by a fixed quote-currency amount (e.g. spend exactly 250 USDT / $250) taken from `fixedQuoteSize`. This is the correct way to enter a fixed dollar amount; it overrides `units`/`unitsType` entirely. Note: there is no `unitsType: "quote"` value, this boolean is the mechanism. Example: true See also: fixedQuoteSize, units ### fixedQuoteSize (decimal) Required: conditional Default: 0 Description: Quote-currency amount when `useFixedSize` is true (e.g. 100 = $100 of BTC at the current mark price). Example: 100 See also: useFixedSize, units ### useEntireAccountBalance (bool) Required: no Default: false Description: Bybit UTA-only shortcut to size the entry using the full available balance after reservations. Ignores `units` and `fixedQuoteSize`. Example: true Gotcha: Bybit UTA-only. On non-UTA accounts this flag is ignored without warning - verify your account mode before relying on it. See also: units, useFixedSize, exchange ## Category: stop-loss ### stopLoss (decimal) Required: conditional Default: 0 Description: Absolute stop-loss price. Required when `stopLossType="absolute"`. Used as the reference for break-even and trailing offsets. Example: 63800 See also: stopLossPercent, stopLossType, stopLossExpression ### stopLossPercent (decimal) Required: conditional Default: 0 Description: Stop-loss distance in percent from entry. Required when `stopLossType="percent"`. Example: 1.5 See also: stopLoss, stopLossType ### stopLossType (string) Required: no Description: How to interpret stop-loss input. `absolute` = price level (or `stopLossExpression`), `percent` = distance from entry. Allowed values: absolute, percent Example: percent See also: stopLoss, stopLossPercent, stopLossExpression ### stopLossExpression (string) Required: no Description: Arithmetic expression evaluated by TVH to produce an absolute stop price (e.g. `"3660-0.02*3660"`). Supports Pine placeholders like `{{strategy.order.price}}`. Operator sign is auto-flipped based on `orderType` so the SL lands on the correct side. PREFERRED: compute the price in Pine and send it directly via `stopLoss` with `stopLossType:"absolute"`; this expression is a fallback for when you cannot precompute. Example: {{strategy.order.price}}-0.02*{{strategy.order.price}} Gotcha: Only evaluated when `stopLossType="absolute"`. Allowed operators: `+ - * /` and parentheses. On any parse error the expression is silently ignored and the stop-loss keeps its prior value (usually 0, i.e. no SL). See also: stopLossType, stopLoss, takeProfitExpression ### useTrailingStopLoss (bool) Required: no Default: false Description: Convert the stop-loss into a trailing stop. TVH manages the trail off-exchange where the exchange has no native primitive. Example: true See also: trailingStopLossPercent, trailingStopLossActivationPercent ### stopLossToBreakEven (bool) Required: no Default: false Description: Trailing-stop companion: when trailing SL is on, the stop locks at break-even (entry) once the trailing threshold is reached, instead of trailing further. Requires useTrailingStopLoss. Binance Futures and Bybit only. Example: true See also: useTrailingStopLoss, trailingStopLossPercent, updateStopLossToBreakEven ### trailingStopLossPercent (decimal) Required: conditional Default: 0 Description: Trail distance in percent. The stop follows price by this offset once activated. Example: 0.7 See also: useTrailingStopLoss, trailingStopLossActivationPercent ### trailingStopLossActivationPercent (decimal) Required: no Default: 0 Description: Profit threshold (percent from entry) before the trailing stop arms. Below this threshold the SL stays at its initial level. Example: 0.5 See also: useTrailingStopLoss, trailingStopLossPercent ### stopLossSizeType (string) Required: no Default: currentPosition Description: Quantity model for the SL order. `currentPosition` = size matches whatever fills (preferred), `absolute` = explicit quantity supplied via `units`. Allowed values: currentPosition, absolute Example: currentPosition Gotcha: `absolute` mode can desync from the live position when entries are partial-filled - prefer `currentPosition` unless you know why. See also: units, unitsType ### cancelSlOrders (bool) Required: no Default: false Description: Cancel all existing stop-loss orders for the pair before placing the new entry/SL. Prevents duplicate SLs when re-entering. Example: true See also: cancelAllOrders, cancelAllDcaOrders ### updateStopLossToBreakEven (bool) Required: no Default: false Description: Standalone command that moves an open position's existing SL to its average entry price (break-even). No new entry placed. Only fires when the position is in profit and already has an SL; not supported on every exchange. Example: true See also: stopLossToBreakEven ## Category: take-profit ### takeProfitExpression (string) Required: no Description: Arithmetic expression evaluated to produce the first target's absolute price (e.g. `"{{strategy.order.price}}+0.02*{{strategy.order.price}}"`). Operator sign auto-flips based on `orderType`. Updates `targets[0].price` only; it does NOT create the target, so you must also send `targetType="absolute"` and a `targets` array. PREFERRED: compute the target price in Pine and send it directly via `targets[].price` with `targetType:"absolute"`; this expression is a fallback for when you cannot precompute. Example: {{strategy.order.price}}+0.02*{{strategy.order.price}} Gotcha: Requires BOTH `targetType="absolute"` AND at least one entry in `targets` (e.g. `"targets":[{"price":0,"amount":100}]`). The expression only overwrites `targets[0].price`; with no `targets` array NO take-profit is placed at all. Only the first target is updated, multi-target ladders need explicit prices on `targets[1..n]`. Percent ladders should use `takeProfitPercent` instead. See also: targetType, targets, stopLossExpression ### targets (List) Required: no Description: Array of take-profit targets. Each entry is a `LimitOrder` with `amount` plus either `price` (absolute targets) or `takeProfitPercent` (percent targets), and optional trailing fields. Order matters - fills are processed in array order. Example: [{"takeProfitPercent":1,"amount":50},{"takeProfitPercent":2,"amount":50}] Gotcha: When `targetAmountInPercent=true` (default in the UI) the sum of `amount` should equal 100; TVH does not auto-normalise. See also: targetType, targetAmountInPercent, setTpToPosition, takeProfitExpression ### targetType (string) Required: no Default: percent Description: Selects the target value field. `percent` = use `targets[].takeProfitPercent`; `absolute` = use explicit `targets[].price` levels (supports `takeProfitExpression`). Allowed values: percent, absolute Example: percent See also: targets, takeProfitExpression ### targetAmountInPercent (bool) Required: no Default: false Description: When true, each target's `amount` is a percent share of the position. When false, `amount` is an absolute quantity in base units. Example: true See also: targets, partialCloseType ### targetAssignedToPosition (bool) Required: no Default: false Description: Bybit-only. When `targets` contains exactly one entry, attach it to the position as a TP-on-position instead of a standalone reduce-only order. Example: true See also: setTpToPosition, targets, exchange ### setTpToPosition (bool) Required: no Default: false Description: Bybit-specific. Attach take-profit orders to the position rather than as separate reduce-only limits. Required when entering via limit orders on Bybit's UTA. Example: true Gotcha: Bybit-only. Has no effect on Binance, OKX, KuCoin, Coinbase, or BitMEX. See also: exchange, targetAssignedToPosition ## Category: futures ### leverage (decimal) Required: no Default: 0 Description: Leverage multiplier to apply before placing the order. TVH updates the exchange-side leverage for the pair only if the requested value differs from the current setting. Example: 10 Gotcha: Some exchanges (Binance, Bybit) reject leverage changes while a position is open. Set leverage in the entry that opens the position, not in a follow-up. See also: marginType, hedgeMode, exchange ### marginType (string) Required: no Description: Per-pair margin mode for the trade. Switches the exchange setting before placing the order if required. Allowed values: isolated, cross Example: isolated Gotcha: Same rule as leverage: most exchanges block margin-type changes with an open position. Set on entry only. See also: leverage, margin ### reduceOnly (bool) Required: no Default: false Description: Mark the order as reduce-only - it can shrink but never increase a position. Used by SL/TP follow-ups and trailing-stop logic. Example: true See also: postOnly, isClose ### postOnly (bool) Required: no Default: true Description: Reject the order if it would take liquidity (= ensures maker fee tier). Default is **true** in TVH; flip to false for limits that must fill aggressively. Example: false Gotcha: Default-on. If your limit price is already through the book the exchange rejects it and the trade is lost - set `postOnly=false` for marketable limits. See also: isLimit, reduceOnly, chaseLimitOrder ### hedgeMode (bool) Required: no Default: false Description: Binance Futures dual-position mode. When true the account allows simultaneous long + short positions and routing uses `positionSide` instead of net direction. Example: true Gotcha: Account-level setting on Binance. Toggling it inside a TradeCommand only succeeds if no positions are open. Pair with `closeLong`/`closeShort` for hedge-mode flat commands. See also: closeLong, closeShort, positionSide, exchange ### margin (bool) Required: no Default: false Description: Flag used by spot-margin adapters to mark the trade as a margin order rather than plain spot. Currently consumed by KuCoin margin and similar adapters. Example: true See also: marginType, exchange ### workingType (string) Required: no Default: mark Description: Binance Futures only. Which price triggers SL/TP stop orders. `mark` is the index/mark price (safer); `contract` is the last trade price. Allowed values: mark, contract Example: mark See also: stopLoss, targets, exchange ### instrumentType (string) Required: no Description: OKX-only product family. Controls which OKX endpoint is used for the order. Allowed values: spot, margin, futures, swap, options Example: swap Gotcha: OKX naming is sometimes counterintuitive: perpetuals are `swap`, dated contracts are `futures`. Match the pair suffix (`...-SWAP`, `...-FUTURES`). See also: exchange, pair, positionSide ### positionSide (string) Required: no Default: net Description: OKX-only side tag. `net` for one-way mode, `long` or `short` when the account runs hedge-mode separately. Allowed values: net, long, short Example: net See also: hedgeMode, instrumentType, exchange ## Category: dca ### useDca (bool) Required: no Default: false Description: Enable the order-mesh entry style: initial market order plus N evenly-sized limit orders below (long) or above (short) entry. Example: true See also: dcaPercent, dcaOrderCount, useScaledOrders ### dcaPercent (decimal) Required: conditional Default: 0 Description: Total spread of the DCA mesh from the initial entry, in percent. TVH spreads `dcaOrderCount` limits evenly across this range. Example: 1.5 See also: useDca, dcaOrderCount ### dcaOrderCount (int) Required: conditional Default: 0 Description: Number of follow-up limit orders in the DCA mesh (not counting the initial market order). Example: 5 See also: useDca, dcaPercent ### useScaledOrders (bool) Required: no Default: false Description: Enable scaled-orders ladder mode. Differs from DCA: you supply an explicit upper/lower price band rather than a percent spread, and there is no market component. Example: true See also: scaledUpperPrice, scaledLowerPrice, scaledOrderNumbers, scaledOrderStyle ### scaledUpperPrice (decimal) Required: conditional Default: 0 Description: Upper price bound of the scaled ladder. For shorts this is the highest entry; for longs the worst (highest) limit if the ladder lays out top-down. Example: 66500 See also: useScaledOrders, scaledLowerPrice, scaledUseCurrentPrice ### scaledLowerPrice (decimal) Required: conditional Default: 0 Description: Lower price bound of the scaled ladder. Example: 64500 See also: useScaledOrders, scaledUpperPrice ### scaledOrderNumbers (int) Required: conditional Default: 0 Description: Number of limit orders to place across the upper/lower band. Example: 8 See also: useScaledOrders, scaledOrderStyle ### scaledOrderStyle (string) Required: no Description: Size distribution style across the ladder. `even` = each leg the same size. `bigSmall` = larger legs at the better-priced side, smaller legs at the worse. `smallBig` = the inverse. Allowed values: even, bigSmall, smallBig Example: even Gotcha: The `bigSmall` / `smallBig` orientation flips based on `isBuy` vs `isSell`. For a buy ladder, `smallBig` puts smaller orders at the highest (worst) entry and larger at the lowest (best) entry; for a sell ladder it inverts. See also: useScaledOrders, scaledOrderNumbers ### scaledUseCurrentPrice (bool) Required: no Default: false Description: When true, treat the current mark/last price as one bound and use only `scaledUpperPrice` **or** `scaledLowerPrice` as the other bound (whichever is set). Example: true See also: useScaledOrders, scaledUpperPrice, scaledLowerPrice ## Category: limit-mgmt ### limitPriceType (string) Required: no Default: fixedPrice Description: How TVH derives the limit price. `fixedPrice` = use `price` verbatim. `bestPrice` = pin to the current best bid (buys) or best ask (sells) at submission time. Allowed values: fixedPrice, bestPrice Example: bestPrice Gotcha: Only two values are honoured. Other strings (`bestBid`, `bestAsk`, `mid`, `lastPrice`) fall through to the `!= "fixedPrice"` branch - they happen to behave like `bestPrice` today but are not part of the supported contract. See also: price, isLimit, chaseLimitOrder ### useLimitClose (bool) Required: no Default: false Description: When set together with a close command, exit the position using a limit order (price from `price` or chase logic) instead of a market order. Example: true Gotcha: Without this flag, an `orderType=close` is forced to market by `CheckForStrategyAlert()` even if `isLimit` is true. See also: isClose, orderType, limitClosePercent, chaseLimitOrder ### limitClosePercent (decimal) Required: no Default: 0 Description: Offset (percent from current price) for the limit-close order. Positive value pushes the close price into profit territory. Example: 0.05 See also: useLimitClose, isClose ### cancelLimitOrderOffset (int) Required: no Default: 0 Description: Delay in seconds after which TVH auto-cancels the still-pending entry/DCA limit orders on the pair. Only runs with `isLimit=true` and a value greater than 0. TP/SL orders are untouched. Capped at 604800 s (7 days). Example: 300 See also: cancelAllOrders, cancelAllDcaOrders ### updateCurrentLimitOrder (bool) Required: no Default: false Description: Reposition the open limit order nearest to market (not the most recent one) to the current best bid/ask. Cancels and re-places it, keeping size and leverage. Ignores `price` - it can only snap to the touch. Example: true Gotcha: Wired only on KuCoin (Futures+Spot), Coinbase (Futures+Spot), and Hyperliquid. No-op on Binance, Binance Futures, Bybit, OKX, and BitMex - use `chaseLimitOrder` there instead. See also: chaseLimitOrder, limitPriceType ### chaseLimitOrder (bool) Required: no Default: false Description: Re-place the limit order at the moving best price until it fills, expires, or the chase budget runs out. Default budget: 180 attempts × 20 s = 1 hour. Example: true See also: updateLimitOrderTimeInterval, updateLimitOrderBuyMarketAfterNotFilled ### updateLimitOrderBuyMarketAfterNotFilled (bool) Required: no Default: false Description: Fallback to market order once the chase budget is exhausted. Otherwise the order is simply cancelled. Example: true See also: chaseLimitOrder, updateLimitOrderTimeInterval ### updateLimitOrderTimeInterval (int) Required: no Default: 20 Description: Seconds to wait between chase attempts. Default 20 s; the chase runs for up to 180 attempts (~1 hour budget). Example: 20 See also: chaseLimitOrder, updateLimitOrderBuyMarketAfterNotFilled ## Category: conditional ### preventPyramiding (bool) Required: no Default: false Description: Hard guard: if a position is already open on the pair, reject the new entry. Prevents stacking on noisy alerts. Example: true See also: conditionalPyramiding, pyramidingValue ### usePartialClose (bool) Required: no Default: false Description: Close only a portion of the current position instead of the whole thing. Size of the cut comes from `partialCloseValue` + `partialCloseType`. Example: true See also: partialCloseValue, partialCloseType, partialCloseAsset ### partialCloseValue (decimal) Required: conditional Default: 0 Description: Amount to close. Interpretation set by `partialCloseType` (percent of position vs absolute units). Example: 50 See also: usePartialClose, partialCloseType, partialCloseAsset ### conditionalPyramiding (bool) Required: no Default: false Description: Soft guard: cap the position size on the pair. Stacking is allowed until the open position reaches `pyramidingValue`, then the new order is trimmed to the remaining capacity or rejected. Only inspects position size - no DCA-leg or order-count check. Example: true See also: preventPyramiding, pyramidingValue, conditionalAsset ### pyramidingValue (decimal) Required: conditional Default: 0 Description: Maximum position size allowed on the pair for `conditionalPyramiding`. A base-asset quantity when `conditionalAsset="base"`, otherwise a quote-currency value. Once reached, further entries are trimmed or rejected. Example: 0.05 See also: conditionalPyramiding, conditionalAsset ### conditionalAsset (string) Required: no Description: Selects how `pyramidingValue` is read: `base` compares against the position's base-asset quantity, `quote` (or empty) against its quote-currency value. Always inspects the same pair's position, not a different asset. Allowed values: base, quote Example: base See also: conditionalPyramiding, pyramidingValue ### closeInProfit (bool) Required: no Default: false Description: Close the existing position only if it is currently in profit by at least `closeInProfitValue` (percent). Useful for break-even-protective exits. Example: true See also: closeInProfitValue, isClose ### partialCloseType (string) Required: no Default: percent Description: Interpret `partialCloseValue` as a percent of the position or as an absolute quantity. Allowed values: percent, absolute Example: percent See also: partialCloseValue, partialCloseAsset ### partialCloseAsset (string) Required: no Default: quote Description: When `partialCloseType="absolute"`, choose whether the value is denominated in the `base` or `quote` asset. Allowed values: base, quote Example: quote See also: partialCloseType, partialCloseValue ### closeInProfitValue (decimal) Required: conditional Default: 0 Description: Minimum profit (percent) required before `closeInProfit` triggers the exit. Below the threshold the close is skipped. Example: 0.2 See also: closeInProfit ## Category: close-cancel ### closeCurrentPosition (bool) Required: no Default: false Description: Close the open position on the pair, regardless of direction. Combine with `useLimitClose` for a non-market exit. Example: true See also: closeLong, closeShort, isClose, useLimitClose ### cancelAllDcaOrders (bool) Required: no Default: false Description: Not an immediate cancel. A companion flag stored with the trade's trailing-stop record; when the trailing stop later closes the position, TVH also cancels the pair's remaining pending orders. Only meaningful alongside a trailing stop. For an immediate DCA-mesh cancel use `cancelAllDca`. Example: true See also: cancelAllDca, useTrailingStopLoss ### cancelAllOrders (bool) Required: no Default: false Description: Cancel **every** open order on the pair (entries, DCA legs, TP, SL). Useful as a reset before a fresh setup. Example: true See also: cancelAll, cancelAllDcaOrders, cancelSlOrders ### closeLong (bool) Required: no Default: false Description: Hedge-mode helper: close only the long side. Required when the account is in dual-position mode and you want to flat one direction. Example: true Gotcha: Auto-reset to false if `orderType="buy"` and no `strategyCloseValue` match - TVH assumes you intend a fresh long entry. See also: closeShort, hedgeMode, isClose ### closeShort (bool) Required: no Default: false Description: Hedge-mode helper: close only the short side. Example: true Gotcha: Auto-reset to false if `orderType="sell"` and no `strategyCloseValue` match. See also: closeLong, hedgeMode, isClose ### cancelAllDca (bool) Required: no Default: false Description: Standalone trade command that cancels the pair's DCA mesh limit orders (TP/SL stay attached) and does nothing else. This is the field that actually clears a pending mesh immediately. Example: true See also: cancelAllOrders, useDca ### cancelAll (bool) Required: no Default: false Description: Standalone command to cancel every pending order on the pair. Counterpart to `cancelAllOrders` when no entry is included. Example: true See also: cancelAllOrders ## Category: timing ### delay (int) Required: no Default: 0 Description: Seconds to wait before TVH forwards the signal to the exchange. Useful for staggered exits or letting the spread settle after news. Example: 5 See also: retries ### retries (int) Required: no Default: 1 Description: How many times TVH re-sends an order when Binance returns an overload / server-busy response. Binance-specific overload guard, not a general cross-exchange retry; does not retry hard rejections or IP bans. Capped at 10. Example: 3 See also: delay, alertTimestamp ### alertTimestamp (string) Required: no Description: Idempotency key. TVH builds a deduplication key from `(token, apiKey-or-exchange, alertTimestamp)` the first time it processes the payload; a later payload with the same triple is recognised as a duplicate and silently dropped. Recommended Pine value: `"{{ticker}}-{{timenow}}"`. Example: BTCUSDT-1715900400000 Gotcha: Without this field, a duplicate webhook (e.g. retry from TradingView's side) opens a second position. Make it part of every alert template. The dedup row persists - re-using the same alertTimestamp string across days will dedup, not just within a short window. See also: retries, delay ## LimitOrder (used by `targets[]`) - idx (int) - price (decimal) - amount (decimal) - takeProfitPercent (decimal) - trailingPercent (decimal)