Execute Trade
execute_tradePlace an order on a connected broker account NOW: market, or a pending LIMIT or STOP order at the broker. Use this when the user wants to trade RIGHT NOW — e.g. "buy EUR/USD", "sell Gold at 2450". This sends the order to the broker instantly. Plain breakout entries ("sell if price breaks below X", "buy above Y") are pending STOP orders: on TradeLocker, cTrader, MetaTrader, Capital.com, Bybit and tastytrade send executionType "STOP" (they wait at the broker and trigger instantly at its price). Use create_conditional_order only for what the broker cannot do: candle closes, liquidity sweeps, time windows, several conditions, or platforms without STOP orders (Match-Trader, Binance). Supports LONG (buy) and SHORT (sell) with stop loss and take profit. You can specify quantity in lots directly, or use percentage-based sizing (sizingMode="percentage") to risk a % of the account balance. IMPORTANT: the percentage is the % of the balance LOST if the stop loss is hit, NOT the share of the balance used to open the trade (1 = lose 1% of the balance at the stop). Typical values are 0.25-2%. Up to 100% is allowed, but above 10% the order is rejected until the user confirms it: explain the risk in plain words (in money if you know the balance, and the total if several orders share it, e.g. 10 ladder orders × 1% = 10% of the account) and only if they confirm, repeat the call with confirmHighRisk: true. Use get_broker_accounts to find available accounts and their IDs. Before sending, ALWAYS get the broker's current price with get_quote and compute levels from it (never from get_ohlc): a BUY LIMIT must be below the ask and a SELL LIMIT above the bid; a BUY STOP above the ask and a SELL STOP below the bid. The stop loss of a buy goes below the entry and of a sell above it. If the user's level is on the wrong side, do not send it: ask. Each execution consumes 1 daily credit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Trading symbol in TraderWAI format (e.g. "EUR_USD", "XAU_USD", "NAS100_USD", "BTC_USD") | |
| quantity | No | Position size in lots (e.g. 0.01 = micro lot, 0.1 = mini lot, 1.0 = standard lot). Required unless using percentage sizing. | |
| stopLoss | Yes | Stop loss price level (absolute price, not pips). The trade will be closed at a loss if price reaches this level. | |
| trailing | No | true: trailing stop executed by the broker — the stop follows price at the initial stop distance (entry to stopLoss) and only moves in favour. Available on cTrader, TradeLocker and MetaTrader (market and pending orders) and Bybit (market orders); rejected on other platforms. backtest_strategy trade.trailing simulates the same rule. | |
| orderType | Yes | Trade direction: "LONG" for buy, "SHORT" for sell | |
| entryPrice | No | Required for LIMIT and STOP orders: the price where the pending order triggers. Ignored for MARKET orders. | |
| sizingMode | No | How to determine position size. "fixed_lots" (default): use the quantity field directly. "percentage": risk a % of account balance (requires sizingValue). | |
| takeProfit | Yes | Take profit price level (absolute price, not pips). The trade will be closed at a profit if price reaches this level. | |
| sizingValue | No | When sizingMode="percentage", the % of the account balance LOST if the stop loss is hit (e.g. 1 = lose 1% at the stop; not the share of the balance used). The lot size is auto-calculated from the SL distance. Above 10 requires confirmHighRisk. | |
| executionType | Yes | "MARKET" fills now at the broker price. "LIMIT" = pending order for a pullback (BUY LIMIT below the ask, SELL LIMIT above the bid). "STOP" = pending order for a breakout (BUY STOP above the ask, SELL STOP below the bid), only on TradeLocker, cTrader, MetaTrader, Capital.com, Bybit and tastytrade; elsewhere use create_conditional_order with action type "market". | |
| brokerAccountId | Yes | ID of the broker account to trade on. Use get_broker_accounts to list available accounts. | |
| confirmHighRisk | No | Only after the user explicitly confirmed a percentage risk above 10% per order. |