Place Order
writes · destructive
Place a new trading order on cTrader via FIX API.
Submits an order after passing 11 risk checks including kill switch, rate limits, position size limits, and daily loss limits.
PARAMETERS:
- symbol: Exact symbol name (e.g., “EURUSD”, “GBPUSD”, “XAUUSD”)
- side: “BUY” for long, “SELL” for short
- volume: In UNITS, not lots
- FX pairs: 100000 = 1 standard lot, 10000 = 0.1 lot
- Gold (XAUUSD): 10 = 1 lot, 1000 = 100 lots (broker min!)
- Silver (XAGUSD): 500 = 1 lot (broker min!)
- Check symbol lot size in config
- orderType: “MARKET” (immediate), “LIMIT” (pending at price), “STOP” (stop order)
- Note: STOP_LIMIT is NOT supported by the broker
- timeInForce: “GTC” (default, good till cancel), “DAY”, “IOC”, “FOK”
- price: Required for LIMIT and STOP_LIMIT orders (absolute price level)
- stopPrice: Required for STOP and STOP_LIMIT orders (trigger price)
- positionId: REQUIRED for SL/TP orders. Without positionId, STOP/LIMIT orders open a NEW independent position instead of closing the target position. Always get the position ID from get_positions first.
RISK CHECKS (all automatic): Position size, open position count, daily loss limit, and rate limits are enforced. Order may be rejected with detailed reason and suggestion.
MODES:
- readonly: Rejected with MODE_RESTRICTED error
- paper: Validated and logged, but NOT sent to broker
- live: Validated and sent to broker (real execution)
RESPONSE:
- On MARKET fill: returns orderId, clOrdId, status, avgPrice, and positionId. Use positionId to place linked STOP/LIMIT orders for SL/TP protection.
- On LIMIT/STOP acceptance: returns orderId, clOrdId, status (NEW). Returns structured error on failure with reason and suggestions for the LLM to adjust parameters.
SL/TP WORKFLOW:
- Place MARKET order → get positionId from response (data.positionId field)
- Place STOP order with positionId (opposite side) → Stop-Loss
- Place LIMIT order with positionId (opposite side) → Take-Profit OCO: When a position closes (SL/TP fill or close_position), the server auto-cancels all remaining linked pending orders.
SL/TP PRICE RULES:
- BUY position: SL stopPrice BELOW entry price, TP price ABOVE entry price
- SELL position: SL stopPrice ABOVE entry price, TP price BELOW entry price
- Use get_quote to get current bid/ask before computing SL/TP levels
CALCULATING VOLUME (accuracy step):
- Volume is in UNITS, not lots: desired_lots × LOT_SIZE = units. Verify LOT_SIZE via get_symbols (or get_knowledge topic “order-guide” if unsure).
- Show the user the volume in both lots and units, and confirm once before submitting.
- Cross-check the magnitude: 1 FX lot = 100,000 units (not 10,000 or 1,000,000); 1 lot XAUUSD = 10 units. A misplaced zero is a 10× error — this cross-check is how you catch it. The server validates and executes; no gating is needed beyond the single user confirmation.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
symbol | string | Yes | Symbol name (e.g., ‘EURUSD’, ‘GBPUSD’, ‘XAUUSD’) |
side | "BUY", "SELL" | Yes | Order side: ‘BUY’ for long positions, ‘SELL’ for short positions |
volume | number | Yes | Order volume in UNITS (not lots). Examples: 100000 = 1 standard lot FX, 10 = 1 lot XAUUSD, 0.01 = 0.01 lot BTCUSD. Fractional values allowed for instruments with small lot sizes. Use symbol lot size from get_symbols. |
orderType | "MARKET", "LIMIT", "STOP", "STOP_LIMIT" | Yes | Order type: ‘MARKET’ (immediate execution), ‘LIMIT’ (pending at price), ‘STOP’ (stop order). ⚠️ STOP_LIMIT is NOT supported by the broker and will be rejected. |
timeInForce | "GTC", "DAY", "IOC", "FOK", "GTD" | No | Time in force: ‘GTC’ (good till cancel, default), ‘DAY’ (expires end of day), ‘IOC’ (immediate or cancel), ‘FOK’ (fill or kill), ‘GTD’ (good till date, requires expireTime) Default: GTC. |
price | number | No | Limit price (required for LIMIT and STOP_LIMIT orders) |
stopPrice | number | No | Stop trigger price (required for STOP and STOP_LIMIT orders) |
positionId | string | No | Position ID to link this order to an existing position. REQUIRED for SL/TP orders — without it, STOP/LIMIT orders open a new independent position instead of closing the target position. Get the positionId from the place_order MARKET fill response, or from get_positions for pre-existing positions. |
comment | string | No | Optional order comment/label |
expireTime | string | No | Optional expiration time in ISO 8601 format (e.g., ‘2025-12-31T23:59:59Z’). Used with DAY or GTC timeInForce. |
