# Tickwire > One API for hosted MetaTrader 4 and 5 terminals, with per-account health checks, idempotent orders, an audit log, webhooks and an MCP server for AI agents. Tickwire is a hosted API for MetaTrader 4 and MetaTrader 5. It runs a real MT4 or MT5 terminal in the cloud for each trading account and works with any broker that offers MT4 or MT5. Your code, trading tools and AI agents use it over REST, WebSocket or a hosted MCP server that works with AI apps such as Claude and ChatGPT. Plans start at $12 per account a month, with a 7-day free trial and a free sandbox. Tickwire runs a real MT4 or MT5 terminal for each trading account and serves it over REST and WebSocket. The same endpoints and fields work for both platforms; the few MT5-only calls return `not_supported_on_mt4` on MT4. Orders take an `Idempotency-Key`, so a retry with the same key never places a second order, and an outcome that can't be confirmed is reported as `unknown`. The MCP server for AI apps such as Claude and ChatGPT is at https://api.tickwire.io/mcp. A free sandbox needs no broker account (https://tickwire.io/docs/sandbox.md). Every docs page below is Markdown. The full text of all of them is at https://tickwire.io/llms-full.txt. The OpenAPI document is at https://tickwire.io/openapi.json. ## Product - [Tickwire](https://tickwire.io/): what Tickwire is, for developers and AI agents - [About and facts](https://tickwire.io/about/): what Tickwire is, the platforms, the prices and who runs it, in one fact sheet - [MT5 API](https://tickwire.io/mt5-api/): the MetaTrader 5 REST and WebSocket API - [MT4 API](https://tickwire.io/mt4-api/): the MetaTrader 4 API, and what MT4 can't do - [AI trading agents](https://tickwire.io/ai-agents/): the MCP server, and connecting Claude or ChatGPT - [MetaTrader API alternative](https://tickwire.io/metatrader-api-alternative/): switching from another MetaTrader API: what stays the same - [MT5 Python API](https://tickwire.io/mt5-python-api/): MetaTrader 5 from Python on macOS, Linux or any server - [MetaTrader MCP server](https://tickwire.io/metatrader-mcp-server/): the hosted MCP server for MT4 and MT5, for Claude, ChatGPT and other MCP apps - [AI trading on MT5](https://tickwire.io/ai-trading-mt5/): connecting ChatGPT, Claude or your own AI to an MT4 or MT5 account, with controls - [TradingView alerts](https://tickwire.io/tradingview-alerts/): sending TradingView alerts to an MT4 or MT5 account by webhook: sizing, stops and safe repeats - [MetaTrader web API](https://tickwire.io/metatrader-web-api/): a cloud web API for MT4 and MT5 accounts, and how it differs from the broker server API - [Copy trading API](https://tickwire.io/copy-trading-api/): building an MT5 or MT4 trade copier: source stream, batch orders to up to 20 accounts, safe retries - [MetaTrader API for prop firm tools](https://tickwire.io/prop-firm-api/): watching equity on many accounts, broker-time days, health webhooks and flattening on breach - [MetaTrader API cost](https://tickwire.io/metatrader-api-cost/): what the API costs per MT4 or MT5 account, with totals for 1 to 200 accounts - [AI prompts](https://tickwire.io/prompts/): paste-ready prompts for an AI app connected through the MCP server, with the access and tools each needs - [Pricing](https://tickwire.io/pricing/): plans in USD, per account per month - [Compare](https://tickwire.io/compare/): hosted MetaTrader API providers, feature by feature - [FAQ](https://tickwire.io/faq/): billing, platforms, brokers and AI agents - [Affiliates](https://tickwire.io/affiliates/): the affiliate program: share a link, your customers pay less and you earn a share - [MetaTrader error codes](https://tickwire.io/metatrader-errors/): MT4 and MT5 error and return codes: meaning, fix, and whether to retry - [MT5 Python functions](https://tickwire.io/mt5-python/): every function of the MetaTrader5 Python package: parameters, returns, mistakes and the REST equivalent ## FAQ - [Tickwire FAQ](https://tickwire.io/faq.md): every question and answer on billing, platforms, brokers and AI agents ## Get started - [Tickwire docs](https://tickwire.io/docs/index.md): Read, stream and trade MetaTrader 4 and 5 accounts over one API, with a health check for each account. - [Quickstart](https://tickwire.io/docs/quickstart.md): Your first call in under two minutes, in the free sandbox. Then connect your broker account and run the same calls. - [Sandbox](https://tickwire.io/docs/sandbox.md): Free simulated MT4 and MT5 accounts. No card, no broker login, no terminal boot. Your first call in under two minutes. - [CLI](https://tickwire.io/docs/cli.md): The tickwire command. Sign in, create a sandbox, list accounts, trade (with a reason) and see the result, forward webhooks to localhost, and tail your request log. - [Python SDK](https://tickwire.io/docs/sdk-python.md): The tickwire Python package. Typed sync and async clients for MT4 and MT5 accounts, with idempotent trading, safe retries, resumable streams and webhook verification. ## Concepts - [Authentication](https://tickwire.io/docs/authentication.md): The header forms Tickwire accepts, token kinds, and how to narrow a token's reach. - [MT4 and MT5](https://tickwire.io/docs/platforms.md): One API for both platforms, and the few things MT4 can't do. - [Health](https://tickwire.io/docs/health.md): How Tickwire decides whether an account is working. - [Idempotency and trade outcomes](https://tickwire.io/docs/idempotency.md): How to retry without placing a second order, and what each order result means. - [Time zones and broker time](https://tickwire.io/docs/time-zones.md): Why broker time isn't UTC, how Tickwire labels it, and how to get day boundaries right. - [Uptime](https://tickwire.io/docs/uptime.md): How Tickwire measures each account's availability, what counts as down, and whose side an outage was on. ## Guides - [Build a prop risk tool](https://tickwire.io/docs/guides/prop-risk-tool.md): Watch equity on many accounts, enforce daily and maximum drawdown, and flatten on breach. - [Build a trade copier](https://tickwire.io/docs/guides/copier.md): Copy trades from one account to many, with idempotency keys so a retry never fills twice, and handle the ones that can't be confirmed. - [Build a trading journal](https://tickwire.io/docs/guides/journal.md): Sync closed trades read-only with investor passwords, incrementally and without gaps. - [Build a trading bot](https://tickwire.io/docs/guides/trading-bot.md): Stream prices, place orders, and handle disconnects and ambiguous fills correctly. - [Example projects](https://tickwire.io/docs/guides/examples.md): Starter templates to copy. Quickstarts in Python and TypeScript, webhook receivers, a pre-trade guard and an AI assistant over MCP. Sandbox only, MIT licensed. - [Build an AI trading agent](https://tickwire.io/docs/guides/ai-agent.md): Give your own AI agent a scoped agent key, connect it to the Tickwire MCP server or the agent REST routes, and handle held, rejected and unknown outcomes safely. - [Send TradingView alerts to MT4 and MT5](https://tickwire.io/docs/guides/tradingview-alerts.md): Paste one Tickwire URL into a TradingView alert and each alert becomes a checked, recorded order on your MT4 or MT5 account. Size by risk, set stops in points or pips, and a repeated alert never trades twice. ## Streaming and events - [Streaming](https://tickwire.io/docs/streaming.md): The per-account WebSocket protocol. Full sync, incremental updates, market data, sequence numbers and resume. - [Webhooks](https://tickwire.io/docs/webhooks.md): Signed event delivery, retries for 72 hours, the delivery log, resend, secret rotation and the event catalog. - [Status feed](https://tickwire.io/docs/status-feed.md): The public status feed behind the status page, the RSS, Atom and JSON incident feeds, email updates, and how to read them. ## Operations - [Errors](https://tickwire.io/docs/errors.md): The error envelope, the codes you'll see, and which ones are safe to retry. - [Rate limits](https://tickwire.io/docs/rate-limits.md): The real limits, what each call costs, the headers you get, and how to back off without making things worse. - [Broker onboarding](https://tickwire.io/docs/broker-onboarding.md): Connect an account on any MT4 or MT5 broker, and what to do when we can't find the server. - [Request logs](https://tickwire.io/docs/request-logs.md): Every API call your keys made in the last 14 days, with redacted bodies for errors, in the dashboard and the API. ## Migrate - [Switching from another provider](https://tickwire.io/docs/switching.md): Move an existing MT4/MT5 API integration to Tickwire by changing the base URL and the key, and what differs. ## Reference - [Pagination](https://tickwire.io/docs/pagination.md): Cursor pagination on the native /v1 lists, and which lists keep their upstream shapes. - [Changelog](https://tickwire.io/docs/changelog.md): Changes to the API and docs, newest first. - [Versioning and deprecation](https://tickwire.io/docs/versioning.md): Dated API versions, what we count as a breaking change, and how long you get before anything goes away. - [API changelog](https://tickwire.io/docs/changelog-api.md): Every API version, breaking change and deprecation, newest first. - [API reference](https://tickwire.io/docs/reference.md): every operation, grouped by API family - [Account REST API (/users/current): Accounts and provisioning](https://tickwire.io/docs/reference/provisioning.md): 20 operations - [Account REST API (/users/current): Account state](https://tickwire.io/docs/reference/account-state.md): 7 operations - [Account REST API (/users/current): Market data](https://tickwire.io/docs/reference/market-data.md): 9 operations - [Account REST API (/users/current): History](https://tickwire.io/docs/reference/history.md): 6 operations - [Account REST API (/users/current): Trading](https://tickwire.io/docs/reference/trading.md): 5 operations - [Account REST API (/users/current): Health, uptime, snapshot and audit trail](https://tickwire.io/docs/reference/account-health-audit.md): 4 operations - [Account REST API (/users/current): Speed and execution quality](https://tickwire.io/docs/reference/speed-quality.md): 4 operations - [Account REST API (/users/current): Tokens and discovery](https://tickwire.io/docs/reference/tokens-discovery.md): 10 operations - [Terminal routes and batch orders: MT5 terminal](https://tickwire.io/docs/reference/mt5-terminal.md): 19 operations - [Terminal routes and batch orders: MT4 terminal](https://tickwire.io/docs/reference/mt4-terminal.md): 19 operations - [Terminal routes and batch orders: Batch orders](https://tickwire.io/docs/reference/batch-orders.md): 2 operations - [Native /v1: Sandbox](https://tickwire.io/docs/reference/sandbox.md): 3 operations - [Native /v1: Accounts](https://tickwire.io/docs/reference/accounts.md): 5 operations - [Native /v1: Webhooks and events](https://tickwire.io/docs/reference/webhooks.md): 18 operations - [Native /v1: Read-only keys](https://tickwire.io/docs/reference/keys.md): 6 operations - [Native /v1: Private servers](https://tickwire.io/docs/reference/private-servers.md): 8 operations - [Native /v1: Dedicated IPs and billing](https://tickwire.io/docs/reference/billing.md): 12 operations - [Native /v1: Identity and other routes](https://tickwire.io/docs/reference/native-other.md): 14 operations - [AI agents: Agent API](https://tickwire.io/docs/reference/agent-api.md): 16 operations - [AI agents: Agent keys and kill switches](https://tickwire.io/docs/reference/agent-admin.md): 9 operations - [AI agents: Pre-trade hooks and holds](https://tickwire.io/docs/reference/pretrade.md): 10 operations - [AI agents: Sign in with Tickwire (OAuth) and connected apps](https://tickwire.io/docs/reference/oauth.md): 9 operations - [Guarded execution: Guarded trades](https://tickwire.io/docs/reference/execution.md): 1 operations - [Models](https://tickwire.io/docs/reference/models.md): every schema ## Blog - [MT4 API documentation: REST and WebSocket in 2026](https://tickwire.io/blog/mt4-api-documentation-guide.md): Tickwire gives MetaTrader 4 a documented REST and WebSocket API on a hosted terminal. This guide maps the MT4 API docs: endpoints, streams, errors and limits. - [Risk controls for AI trading agents](https://tickwire.io/blog/ai-agent-risk-controls.md): The controls that keep an AI trading agent inside its limits: scoped and read-only keys, kill switches, a fail-closed pre-trade hook, idempotent orders and an audit log. - [Which AI apps can place trades on MT4 and MT5?](https://tickwire.io/blog/ai-apps-that-can-trade.md): Which chat apps and developer tools can connect to a MetaTrader account and place orders, as of October 2026, and what to check before you let one trade. - [Why every AI trade needs a reason and a record](https://tickwire.io/blog/ai-trading-agent-audit-trail.md): Why an AI trading agent should state a reason for every order, what a useful audit log records, how to read one, and a weekly checklist for spotting loops and mistakes. - [Why live results differ from your backtest](https://tickwire.io/blog/backtest-vs-live-results.md): The usual reasons a strategy earns less live than in its backtest: costs, slippage, data, time zones, overfitting and outages, and how to measure the gap. - [Broker server time is not UTC](https://tickwire.io/blog/broker-time-is-not-utc.md): Why MetaTrader servers often run on UTC+2 in winter and UTC+3 in summer, how that shifts candles, deals and daily loss limits, and how to convert broker time correctly. - [Candles and timeframes from an MT5 API](https://tickwire.io/blog/candles-and-timeframes-api.md): OHLCV candles from MT4 and MT5 explained: timeframes from M1 to MN1, the forming candle, broker time in timestamps, gaps, paging long ranges and tick volume. - [How to connect Claude to your MT4 or MT5 account](https://tickwire.io/blog/connect-claude-to-mt5.md): Step by step: add a MetaTrader account to Claude as a custom connector, sign in, choose Look only or Look and trade, ask safe first questions, and know how to cut it off. - [Build your first MT5 trading bot in Python](https://tickwire.io/blog/first-mt5-bot-in-python.md): A small Python trading bot for MT5 over plain REST: health checks, candles, a toy moving-average signal, orders that can't double, and correct handling of unknown outcomes. - [Getting started with algorithmic trading](https://tickwire.io/blog/getting-started-algo-trading.md): What algorithmic trading is, the parts every trading system needs, how to write rules a computer can follow, and how to test and run them without avoidable losses. - [Hosted terminals vs MetaTrader on a VPS](https://tickwire.io/blog/hosted-terminal-vs-vps.md): Running MT4 or MT5 on your own VPS or using a hosted terminal API: an objective comparison of cost, control, maintenance and monitoring. - [How trade copiers work on MT4 and MT5](https://tickwire.io/blog/how-trade-copiers-work.md): Master and follower accounts, volume and symbol mapping, partial closes, rejections and reconcile loops: how a trade copier works, and how to stop it copying a trade twice. - [Is your trading bot really connected?](https://tickwire.io/blog/is-my-bot-really-connected.md): A running MetaTrader terminal is not a working one. How to tell connected from merely alive, using the broker link, account reads and price movement, on MT4 and MT5. - [Keeping trading API keys safe](https://tickwire.io/blog/keep-trading-api-keys-safe.md): Where to keep a trading API key, how to give each app the least access it needs, how to rotate and revoke, and how to stop keys leaking into code, prompts and logs. - [Lots, pips and position size, explained](https://tickwire.io/blog/lots-pips-position-size.md): What lots, pips and points mean on MT4 and MT5, how to work out pip value, and how to size a position from a risk amount and a stop distance in Python. - [Market hours, weekends and gaps for trading bots](https://tickwire.io/blog/market-hours-weekend-gaps.md): When forex and other MetaTrader symbols trade, what weekend gaps do to stops, why spreads widen at rollover, and what a trading bot should do when the market is closed. - [MT4 and MT5 order types, explained for API users](https://tickwire.io/blog/mt4-mt5-order-types.md): Market, limit, stop and stop limit orders on MT4 and MT5, plus stop loss, take profit, expiry and fill rules, with the API fields that set each one. - [MT4 vs MT5 for algorithmic trading](https://tickwire.io/blog/mt4-vs-mt5-for-algo-trading.md): How MetaTrader 4 and MetaTrader 5 differ for automated trading: order types, positions, timeframes, backtesting, data and code, and how to choose. - [Trading MT5 from Python on a Mac or Linux](https://tickwire.io/blog/mt5-python-on-mac-and-linux.md): The official MetaTrader 5 Python library needs Windows. Here are the honest options for Mac and Linux users: a Windows VM, a VPS, or a hosted REST API. - [Netting vs hedging accounts on MT5](https://tickwire.io/blog/netting-vs-hedging-mt5.md): What netting, exchange and hedging margin modes do to your positions on MT5, how closing differs in each, and how to detect the mode before your bot trades. - [Coding prop firm drawdown rules correctly](https://tickwire.io/blog/prop-firm-drawdown-rules-in-code.md): Daily loss and maximum drawdown rules in code: balance or equity, static or trailing, when the trading day starts, buffers, and a Python check that knows when it doesn't know. - [Prop firm accounts and your IP address](https://tickwire.io/blog/prop-firms-and-ip-addresses.md): Why prop firms often look at IP addresses and devices, what shared and dedicated addresses mean, and why your own firm's written rules are the only answer that counts. - [A retry should never place a second trade](https://tickwire.io/blog/retries-never-trade-twice.md): Why a timed-out order request may still have filled, and how idempotency keys, an honest unknown result and careful reconciling keep a retry from opening a second position. - [Safe prompts for an AI trading assistant](https://tickwire.io/blog/safe-prompts-ai-trading.md): Prompts that make an AI trading assistant check before it acts, state orders exactly, handle unclear results, and never retry into a second trade, plus prompts to avoid. - [Slippage, requotes and fills, explained](https://tickwire.io/blog/slippage-requotes-fills.md): How MT4 and MT5 fill market orders: execution modes, slippage and the deviation setting, requotes, partial fills, MT5 filling modes, and how to measure what happened. - [Setting stop loss and take profit through an API](https://tickwire.io/blog/stop-loss-take-profit-api.md): Where stop loss and take profit go for buys and sells on MT4 and MT5, why stops get rejected, how to move them on an open position, and how to trail a stop in code. - [Streaming MT4 and MT5 prices over WebSocket](https://tickwire.io/blog/stream-mt5-prices-websocket.md): How a live price stream works for MT4 and MT5: subscribing, reconnecting with backoff, heartbeats, telling a closed market from a broken feed, throttling and candles. - [Symbol names, suffixes and contract specs](https://tickwire.io/blog/symbol-names-and-specs.md): Why EURUSD is called something else on many MT4 and MT5 accounts, how to find the right symbol in code, and which contract spec fields to read instead of hard-coding. - [Build a trading journal from your MT5 history](https://tickwire.io/blog/trading-journal-from-history.md): How MT5 deals, orders and positions fit together, how to group deals into round-trip trades with pandas, and how to read win rate, expectancy and drawdown honestly. - [Webhooks vs polling for trading apps](https://tickwire.io/blog/webhooks-vs-polling.md): When to poll, when to take webhooks and when to stream: latency, rate limits, retries, duplicates, signature checks and the reconcile loop that catches what all three miss. - [What MCP is, and why traders should care](https://tickwire.io/blog/what-is-mcp-for-traders.md): A plain guide to the Model Context Protocol: how AI apps call tools, what a trade tool call looks like, local vs hosted servers, and the risks traders should know. - [Why your AI assistant says it can't trade](https://tickwire.io/blog/why-ai-assistant-wont-trade.md): Why chat assistants refuse to place trades: no broker connection by default, safety rules, the need for an explicit tool, and confirmations for consequential actions. - [Write a pre-trade hook for an AI trading agent](https://tickwire.io/blog/write-a-pre-trade-hook.md): Build a small Python service that checks every AI agent order before it reaches the broker: verify the HMAC signature, apply size, symbol, hours and daily loss rules, and answer. ## MetaTrader5 Python functions - [mt5.initialize() in MetaTrader5 Python: connect Python to the terminal](https://tickwire.io/mt5-python/initialize/): Opens the link between your Python script and a MetaTrader 5 terminal, and can log in to an account in the same call. Returns True or False. - [mt5.login() in MetaTrader5 Python: log in to a trading account](https://tickwire.io/mt5-python/login/): Logs the connected terminal in to a trading account, or switches it to another one. Returns True when the login worked and False when it did not. - [mt5.shutdown() in MetaTrader5 Python: close the link to the terminal](https://tickwire.io/mt5-python/shutdown/): Closes the link that initialize() opened between your script and the MetaTrader 5 terminal. It takes no arguments and returns None. - [mt5.version() in MetaTrader5 Python: read the terminal's version and build](https://tickwire.io/mt5-python/version/): Returns the version, build number and release date of the MetaTrader 5 terminal your script is linked to, or None when the call fails. - [mt5.last_error() in MetaTrader5 Python: find out why the last call failed](https://tickwire.io/mt5-python/last-error/): Returns the code and description of the last error the MetaTrader5 package recorded. Call it right after a function returns None or False. - [mt5.account_info() in MetaTrader5 Python: read balance, equity and margin](https://tickwire.io/mt5-python/account-info/): Returns the logged-in trading account as a named tuple: login, balance, equity, margin, free margin, leverage, currency and more. None if it fails. - [mt5.terminal_info() in MetaTrader5 Python: check the terminal and its broker link](https://tickwire.io/mt5-python/terminal-info/): Returns the state and settings of the MetaTrader 5 terminal as a named tuple, including whether it is connected to the broker and allows algo trading. - [mt5.symbols_total() in MetaTrader5 Python: count every symbol the terminal knows](https://tickwire.io/mt5-python/symbols-total/): Returns how many symbols the MetaTrader 5 terminal knows, including custom symbols and ones hidden from Market Watch. Returns an integer. - [mt5.symbols_get() in MetaTrader5 Python: list symbols, with an optional filter](https://tickwire.io/mt5-python/symbols-get/): Returns the terminal's symbols as a tuple of named tuples, all of them or only those that match a group filter such as "*USD*". None on failure. - [mt5.symbol_info() in MetaTrader5 Python: read a symbol's settings and limits](https://tickwire.io/mt5-python/symbol-info/): Returns everything the terminal knows about one symbol as a named tuple: digits, point, contract size, volume limits, filling modes and more. None if unknown. - [mt5.symbol_info_tick() in MetaTrader5 Python: get the latest bid and ask](https://tickwire.io/mt5-python/symbol-info-tick/): Returns the last tick of a symbol: time, bid, ask, last price and volume. Use it for the current price. Returns None when there is no tick. - [mt5.symbol_select() in MetaTrader5 Python: add a symbol to Market Watch](https://tickwire.io/mt5-python/symbol-select/): Adds a symbol to the terminal's Market Watch, or removes it. Most price and data functions need the symbol selected first. Returns True or False. - [mt5.market_book_add() in MetaTrader5 Python: subscribe to market depth](https://tickwire.io/mt5-python/market-book-add/): Subscribes the terminal to market depth, the order book, for one symbol. You need it before market_book_get() returns anything. Returns True or False. - [mt5.market_book_get() in MetaTrader5 Python: read the order book of a symbol](https://tickwire.io/mt5-python/market-book-get/): Returns the current market depth of a symbol as a tuple of levels, each with a type, a price and a volume. Needs market_book_add() first. None on failure. - [mt5.market_book_release() in MetaTrader5 Python: stop a market depth subscription](https://tickwire.io/mt5-python/market-book-release/): Ends the market depth subscription that market_book_add() started for a symbol, so the terminal stops collecting its order book. Returns True or False. - [mt5.copy_rates_from() in MetaTrader5 Python: get bars back from a date](https://tickwire.io/mt5-python/copy-rates-from/): Copies a number of bars of one symbol and timeframe, ending at a date you give, into a numpy array. Returns None when the bars can't be read. - [mt5.copy_rates_from_pos() in MetaTrader5 Python: get the latest bars by position](https://tickwire.io/mt5-python/copy-rates-from-pos/): Copies bars of one symbol and timeframe counted from a bar position, where 0 is the bar that is still forming. Returns a numpy array, or None on failure. - [mt5.copy_rates_range() in MetaTrader5 Python: get bars between two dates](https://tickwire.io/mt5-python/copy-rates-range/): Copies every bar of one symbol and timeframe that opened between two dates into a numpy array. Returns None when the bars can't be read. - [mt5.copy_ticks_from() in MetaTrader5 Python: get ticks forward from a date](https://tickwire.io/mt5-python/copy-ticks-from/): Copies a number of ticks of one symbol, starting at a date you give and going forward, into a numpy array. Returns None when the ticks can't be read. - [mt5.copy_ticks_range() in MetaTrader5 Python: get ticks between two dates](https://tickwire.io/mt5-python/copy-ticks-range/): Copies every tick of one symbol between two dates into a numpy array, with flags to choose price ticks or trade ticks. Returns None on failure. - [mt5.orders_total() in MetaTrader5 Python: count pending orders](https://tickwire.io/mt5-python/orders-total/): Returns how many pending orders, such as limits and stops, are open on the account right now. Returns an integer. - [mt5.orders_get() in MetaTrader5 Python: read pending orders](https://tickwire.io/mt5-python/orders-get/): Returns the account's pending orders as a tuple of named tuples, all of them or filtered by symbol, group or ticket. Returns None on failure. - [mt5.positions_total() in MetaTrader5 Python: count open positions](https://tickwire.io/mt5-python/positions-total/): Returns how many positions are open on the account right now. Returns an integer. Use positions_get() to read them. - [mt5.positions_get() in MetaTrader5 Python: read open positions](https://tickwire.io/mt5-python/positions-get/): Returns the account's open positions as a tuple of named tuples, all of them or filtered by symbol, group or ticket. Returns None on failure. - [mt5.order_calc_margin() in MetaTrader5 Python: work out the margin for an order](https://tickwire.io/mt5-python/order-calc-margin/): Works out the margin a buy or sell of a given volume and price would need, in the account currency, without placing anything. Returns a float or None. - [mt5.order_calc_profit() in MetaTrader5 Python: work out profit between two prices](https://tickwire.io/mt5-python/order-calc-profit/): Works out the profit or loss of a buy or sell of a given volume from an open price to a close price, in the account currency. Returns a float or None. - [mt5.order_check() in MetaTrader5 Python: test an order before you send it](https://tickwire.io/mt5-python/order-check/): Checks whether a trade request would go through, and shows the balance, equity and margin after it, without sending it. Returns a result or None. - [mt5.order_send() in MetaTrader5 Python: place, change or close a trade](https://tickwire.io/mt5-python/order-send/): Sends a trade request to the broker: open a position, place a pending order, change stops, or close. Returns a result with a retcode, or None. - [mt5.history_orders_total() in MetaTrader5 Python: count orders in history](https://tickwire.io/mt5-python/history-orders-total/): Returns how many orders in the account's history fall between two dates: filled, canceled and expired orders. Returns an integer. - [mt5.history_orders_get() in MetaTrader5 Python: read past orders](https://tickwire.io/mt5-python/history-orders-get/): Returns orders from the account's history as a tuple of named tuples: by date range, with an optional symbol filter, or by order or position ticket. - [mt5.history_deals_total() in MetaTrader5 Python: count deals in history](https://tickwire.io/mt5-python/history-deals-total/): Returns how many deals, the actual fills plus balance operations, are in the account's history between two dates. Returns an integer. - [mt5.history_deals_get() in MetaTrader5 Python: read past deals and fills](https://tickwire.io/mt5-python/history-deals-get/): Returns deals from the account's history as a tuple of named tuples, with price, volume, profit, commission and swap. By date range, order or position. ## MetaTrader error codes - [MT5 error 10004: Requote (TRADE_RETCODE_REQUOTE)](https://tickwire.io/metatrader-errors/mt5-10004-requote/): The server offered a new price instead of filling at yours. Nothing was executed; refresh the quote and send again. - [MT5 error 10006: Request rejected (TRADE_RETCODE_REJECT)](https://tickwire.io/metatrader-errors/mt5-10006-request-rejected/): The trade server refused the request without a more specific reason. Nothing was executed; read the comment before sending again. - [MT5 error 10007: Request canceled by trader (TRADE_RETCODE_CANCEL)](https://tickwire.io/metatrader-errors/mt5-10007-request-canceled/): The request was canceled on the terminal side before it reached the market. Nothing was executed. - [MT5 return code 10008: Order placed (TRADE_RETCODE_PLACED)](https://tickwire.io/metatrader-errors/mt5-10008-order-placed/): MT5 return code 10008 is a success: the order was accepted and placed. Don't resend it, or you will place a second order. - [MT5 return code 10009: Request completed (TRADE_RETCODE_DONE)](https://tickwire.io/metatrader-errors/mt5-10009-request-completed/): MT5 return code 10009 means the trade request completed. The deal, close or change happened; read the result and don't send it again. - [MT5 return code 10010: Only part of the request was completed (TRADE_RETCODE_DONE_PARTIAL)](https://tickwire.io/metatrader-errors/mt5-10010-done-partial/): MT5 return code 10010 means only part of the volume was filled. The filled part is real; decide on purpose whether to send the rest. - [MT5 error 10011: Request processing error (TRADE_RETCODE_ERROR)](https://tickwire.io/metatrader-errors/mt5-10011-request-processing-error/): Something failed while the request was being processed. The order may or may not have executed, so check positions and deals before any retry. - [MT5 error 10012: Request canceled by timeout (TRADE_RETCODE_TIMEOUT)](https://tickwire.io/metatrader-errors/mt5-10012-request-timeout/): The request ran out of time before a final answer came back. It may still have executed; check the account before sending again. - [MT5 error 10013: Invalid request (TRADE_RETCODE_INVALID)](https://tickwire.io/metatrader-errors/mt5-10013-invalid-request/): The trade request is malformed or incomplete, so the server refused it. Nothing was executed; fix the fields and send again. - [MT5 error 10014: Invalid volume (TRADE_RETCODE_INVALID_VOLUME)](https://tickwire.io/metatrader-errors/mt5-10014-invalid-volume/): The lot size is below the minimum, above the maximum or off the volume step. Nothing was executed; round the volume and resend. - [MT5 error 10015: Invalid price (TRADE_RETCODE_INVALID_PRICE)](https://tickwire.io/metatrader-errors/mt5-10015-invalid-price/): The price in the request is not allowed: wrong side of the market for a pending order, or not on the price grid. Nothing was executed. - [MT5 error 10016: Invalid stops (TRADE_RETCODE_INVALID_STOPS)](https://tickwire.io/metatrader-errors/mt5-10016-invalid-stops/): The stop loss or take profit is on the wrong side or too close to the price. Nothing was executed; move the stops and resend. - [MT5 error 10017: Trade is disabled (TRADE_RETCODE_TRADE_DISABLED)](https://tickwire.io/metatrader-errors/mt5-10017-trade-disabled/): Trading is switched off for this symbol or this account. Nothing was executed; retrying won't help until the broker enables it. - [MT5 error 10018: Market is closed (TRADE_RETCODE_MARKET_CLOSED)](https://tickwire.io/metatrader-errors/mt5-10018-market-closed/): The symbol is outside its trading session, such as a weekend or a holiday. Nothing was executed; wait for the session to open. - [MT5 error 10019: Not enough money (TRADE_RETCODE_NO_MONEY)](https://tickwire.io/metatrader-errors/mt5-10019-not-enough-money/): The account's free margin can't cover the order. Nothing was executed; reduce the volume or free up margin first. - [MT5 error 10020: Prices changed (TRADE_RETCODE_PRICE_CHANGED)](https://tickwire.io/metatrader-errors/mt5-10020-price-changed/): The price moved between your request and the server's check. Nothing was executed; take a fresh quote and send again. - [MT5 error 10021: No quotes to process the request (TRADE_RETCODE_PRICE_OFF)](https://tickwire.io/metatrader-errors/mt5-10021-off-quotes/): The server had no valid price to fill the request at, often called off quotes. Nothing was executed; wait for a fresh tick and retry. - [MT5 error 10022: Invalid expiration (TRADE_RETCODE_INVALID_EXPIRATION)](https://tickwire.io/metatrader-errors/mt5-10022-invalid-expiration/): The pending order's expiration is not allowed for this symbol, or the time is wrong. Nothing was placed; change type_time or the date. - [MT5 error 10023: Order state changed (TRADE_RETCODE_ORDER_CHANGED)](https://tickwire.io/metatrader-errors/mt5-10023-order-state-changed/): The order changed state while your request was on its way, for example it triggered. Read the order again before deciding what to do. - [MT5 error 10024: Too frequent requests (TRADE_RETCODE_TOO_MANY_REQUESTS)](https://tickwire.io/metatrader-errors/mt5-10024-too-many-requests/): You sent trade requests faster than the broker allows. This one was refused; slow down and send it again after a pause. - [MT5 error 10025: No changes in request (TRADE_RETCODE_NO_CHANGES)](https://tickwire.io/metatrader-errors/mt5-10025-no-changes/): The modify request asked for the values the order or position already has. Nothing needed to change, so it counts as success. - [MT5 error 10026: Autotrading disabled by server (TRADE_RETCODE_SERVER_DISABLES_AT)](https://tickwire.io/metatrader-errors/mt5-10026-autotrading-disabled-by-server/): The broker's server doesn't allow automated trading for this account. Nothing was executed; only the broker can change this. - [MT5 error 10027: Autotrading disabled by client terminal (TRADE_RETCODE_CLIENT_DISABLES_AT)](https://tickwire.io/metatrader-errors/mt5-10027-autotrading-disabled-by-client/): Algo Trading is switched off in the MetaTrader 5 terminal, so it won't send orders from code. Turn it on and send again. - [MT5 error 10028: Request locked for processing (TRADE_RETCODE_LOCKED)](https://tickwire.io/metatrader-errors/mt5-10028-request-locked/): The request is locked while the server processes it. The final result is not known yet, so check the account before sending anything again. - [MT5 error 10029: Order or position frozen (TRADE_RETCODE_FROZEN)](https://tickwire.io/metatrader-errors/mt5-10029-frozen/): The price is too close to the order or stop you want to change, inside the freeze level. Nothing changed; wait for the price to move away. - [MT5 error 10030: Invalid order filling type (TRADE_RETCODE_INVALID_FILL)](https://tickwire.io/metatrader-errors/mt5-10030-invalid-fill/): The filling mode (FOK, IOC or Return) isn't allowed for this symbol at this broker. Nothing was executed; pick an allowed mode. - [MT5 error 10031: No connection with the trade server (TRADE_RETCODE_CONNECTION)](https://tickwire.io/metatrader-errors/mt5-10031-no-connection/): The terminal lost its link to the trade server around the time of the request. The order may have executed; check before any retry. - [MT5 error 10032: Operation allowed only for real accounts (TRADE_RETCODE_ONLY_REAL)](https://tickwire.io/metatrader-errors/mt5-10032-only-real-accounts/): The broker allows this operation on real-money accounts only, and this account is not one. Nothing was executed. - [MT5 error 10033: Pending orders limit reached (TRADE_RETCODE_LIMIT_ORDERS)](https://tickwire.io/metatrader-errors/mt5-10033-limit-orders/): The account already has the most pending orders the broker allows. Nothing was placed; delete old orders first. - [MT5 error 10034: Volume limit for the symbol reached (TRADE_RETCODE_LIMIT_VOLUME)](https://tickwire.io/metatrader-errors/mt5-10034-limit-volume/): Your open and pending volume on this symbol has hit the broker's cap. Nothing was executed; reduce your exposure first. - [MT5 error 10035: Incorrect or prohibited order type (TRADE_RETCODE_INVALID_ORDER)](https://tickwire.io/metatrader-errors/mt5-10035-invalid-order-type/): The order type isn't allowed for this symbol, for example a stop limit the broker doesn't offer. Nothing was executed. - [MT5 error 10036: Position already closed (TRADE_RETCODE_POSITION_CLOSED)](https://tickwire.io/metatrader-errors/mt5-10036-position-closed/): The position you named is already closed, perhaps by its stop or by an earlier request. There is nothing left to close. - [MT5 error 10038: Close volume exceeds the position (TRADE_RETCODE_INVALID_CLOSE_VOLUME)](https://tickwire.io/metatrader-errors/mt5-10038-invalid-close-volume/): You asked to close more volume than the position holds. Nothing was closed; read the position's current volume and resend. - [MT5 error 10039: A close order already exists (TRADE_RETCODE_CLOSE_ORDER_EXIST)](https://tickwire.io/metatrader-errors/mt5-10039-close-order-exists/): A close order for this position is already working. Your new close may duplicate it, so check the position before sending another. - [MT5 error 10040: Open positions limit reached (TRADE_RETCODE_LIMIT_POSITIONS)](https://tickwire.io/metatrader-errors/mt5-10040-limit-positions/): The account has reached the broker's cap on open positions. Nothing was executed; close positions before opening more. - [MT5 error 10041: Pending order activation rejected, order canceled (TRADE_RETCODE_REJECT_CANCEL)](https://tickwire.io/metatrader-errors/mt5-10041-activation-rejected/): Your pending order triggered, but the server rejected the fill and canceled the order. No position opened, and the order is gone. - [MT5 error 10042: Only long positions are allowed (TRADE_RETCODE_LONG_ONLY)](https://tickwire.io/metatrader-errors/mt5-10042-long-only/): The symbol only allows buy positions right now. A sell was refused and nothing executed; a buy or a close will still work. - [MT5 error 10043: Only short positions are allowed (TRADE_RETCODE_SHORT_ONLY)](https://tickwire.io/metatrader-errors/mt5-10043-short-only/): The symbol only allows sell positions right now. A buy was refused and nothing executed; sells and closes still work. - [MT5 error 10044: Only position closing is allowed (TRADE_RETCODE_CLOSE_ONLY)](https://tickwire.io/metatrader-errors/mt5-10044-close-only/): The symbol is in close only mode: you can close what you hold but not open anything new. The new order was refused. - [MT5 error 10045: Closing allowed only by FIFO rule (TRADE_RETCODE_FIFO_CLOSE)](https://tickwire.io/metatrader-errors/mt5-10045-fifo-close/): The account must close positions in the order they were opened (FIFO). Close the oldest position on that symbol first. - [MT5 error 10046: Hedging prohibited (TRADE_RETCODE_HEDGE_PROHIBITED)](https://tickwire.io/metatrader-errors/mt5-10046-hedge-prohibited/): The account doesn't allow opposite positions on one symbol. A sell against an open buy (or the reverse) was refused. - [MT5 error 4014: Function is not allowed for call (ERR_FUNCTION_NOT_ALLOWED)](https://tickwire.io/metatrader-errors/mt5-4014-function-not-allowed/): The MQL5 function can't be called from this kind of program or in this context, such as WebRequest from an indicator. - [MT5 error 4301: Unknown symbol (ERR_MARKET_UNKNOWN_SYMBOL)](https://tickwire.io/metatrader-errors/mt5-4301-unknown-symbol/): The terminal doesn't know a symbol with this name. Brokers often add suffixes such as .m or .pro, so check the exact name. - [MT5 error 4302: Symbol is not selected in Market Watch (ERR_MARKET_NOT_SELECTED)](https://tickwire.io/metatrader-errors/mt5-4302-symbol-not-selected/): The symbol exists but isn't in Market Watch, so its prices and some properties aren't available. Select it first. - [MT5 error 4401: Requested history not found (ERR_HISTORY_NOT_FOUND)](https://tickwire.io/metatrader-errors/mt5-4401-history-not-found/): The terminal has no price history for this symbol, timeframe or date range yet. Wait for it to download, or ask for a range it has. - [MT5 error 4751: Wrong trade property identifier (ERR_TRADE_WRONG_PROPERTY)](https://tickwire.io/metatrader-errors/mt5-4751-wrong-trade-property/): A trade property function was asked for a property id that doesn't exist or doesn't fit, such as a deal property on an order. - [MT5 error 4752: Automated trading is not allowed for the program (ERR_TRADE_DISABLED)](https://tickwire.io/metatrader-errors/mt5-4752-trading-not-allowed/): The terminal or this program isn't allowed to trade, so OrderSend refused before sending. Check Algo Trading and the program's settings. - [MT5 error 4753: Position not found (ERR_TRADE_POSITION_NOT_FOUND)](https://tickwire.io/metatrader-errors/mt5-4753-position-not-found/): No open position matches the ticket or symbol you named. It may have closed already, or the id is wrong. - [MT5 error 4754: Order not found (ERR_TRADE_ORDER_NOT_FOUND)](https://tickwire.io/metatrader-errors/mt5-4754-order-not-found/): No pending order matches the ticket you named. It may have filled, expired or been deleted. - [MT5 error 4755: Deal not found (ERR_TRADE_DEAL_NOT_FOUND)](https://tickwire.io/metatrader-errors/mt5-4755-deal-not-found/): The deal ticket isn't in the history the terminal has loaded. Call HistorySelect for the right time range first. - [MT5 error 4756: Trade request sending failed (ERR_TRADE_SEND_FAILED)](https://tickwire.io/metatrader-errors/mt5-4756-trade-send-failed/): OrderSend returned false. The real reason is in the result's retcode, which also tells you whether the order may have executed. - [MT5 error 4758: Failed to calculate profit or margin (ERR_TRADE_CALC_FAILED)](https://tickwire.io/metatrader-errors/mt5-4758-calc-failed/): OrderCalcMargin or OrderCalcProfit couldn't compute a value, often because a price or a conversion rate is missing. - [MT5 Python error -1: Generic failure (RES_E_FAIL)](https://tickwire.io/metatrader-errors/mt5-python-1-call-failed/): A MetaTrader5 package call failed without a more specific reason. Check the arguments, the terminal and the account state. - [MT5 Python error -2: Invalid parameters (RES_E_INVALID_PARAMS)](https://tickwire.io/metatrader-errors/mt5-python-2-invalid-params/): The function got arguments of the wrong type or value, such as a volume passed as an int. Fix the call; nothing was sent. - [MT5 Python error -3: Out of memory (RES_E_NO_MEMORY)](https://tickwire.io/metatrader-errors/mt5-python-3-no-memory/): The call couldn't get enough memory, usually because it asked for a huge amount of tick or bar data at once. Ask in smaller pieces. - [MT5 Python error -4: Not found (RES_E_NOT_FOUND)](https://tickwire.io/metatrader-errors/mt5-python-4-not-found/): What you asked for isn't there, for example no history for that symbol and range. The package's own docs call it no history. - [MT5 Python error -5: Invalid version (RES_E_INVALID_VERSION)](https://tickwire.io/metatrader-errors/mt5-python-5-invalid-version/): The Python package and the MetaTrader 5 terminal don't agree on a version. Update the terminal and the package. - [MT5 Python error -6: Authorization failed (RES_E_AUTH_FAILED)](https://tickwire.io/metatrader-errors/mt5-python-6-authorization-failed/): The login, password or server name was refused when connecting the account. Check the exact server name and the password. - [MT5 Python error -7: Unsupported method (RES_E_UNSUPPORTED)](https://tickwire.io/metatrader-errors/mt5-python-7-unsupported/): The terminal doesn't support the function you called. Update the terminal and package, or use a different call. - [MT5 Python error -8: Auto-trading disabled (RES_E_AUTO_TRADING_DISABLED)](https://tickwire.io/metatrader-errors/mt5-python-8-auto-trading-disabled/): Algo Trading is off in the terminal, so order_send won't trade. Turn it on in the toolbar; nothing was sent. - [MT5 Python error -10000: IPC internal error (RES_E_INTERNAL_FAIL)](https://tickwire.io/metatrader-errors/mt5-python-10000-ipc-internal-error/): The link between Python and the terminal failed in a general way. Shut down the connection, start it again, and check the terminal. - [MT5 Python error -10001: IPC send failed (RES_E_INTERNAL_FAIL_SEND)](https://tickwire.io/metatrader-errors/mt5-python-10001-ipc-send-failed/): Python couldn't pass the command to the terminal. The terminal is likely closed or stuck; reconnect before anything else. - [MT5 Python error -10002: IPC receive failed (RES_E_INTERNAL_FAIL_RECEIVE)](https://tickwire.io/metatrader-errors/mt5-python-10002-ipc-receive-failed/): The command reached the terminal but its answer never came back to Python. An order may have executed; check before resending. - [MT5 Python error -10003: IPC initialize failed (RES_E_INTERNAL_FAIL_INIT)](https://tickwire.io/metatrader-errors/mt5-python-10003-ipc-initialize-failed/): mt5.initialize() couldn't start or find a MetaTrader 5 terminal, often shown as "MetaTrader 5 x64 not found". Pass the path. - [MT5 Python error -10004: No IPC connection (RES_E_INTERNAL_FAIL_CONNECT)](https://tickwire.io/metatrader-errors/mt5-python-10004-no-ipc-connection/): A package function was called with no live connection to the terminal, often before initialize() or after shutdown(). - [MT5 Python error -10005: IPC timeout (RES_E_INTERNAL_FAIL_TIMEOUT)](https://tickwire.io/metatrader-errors/mt5-python-10005-ipc-timeout/): The terminal didn't answer in time. At connect time the terminal was slow to start; during order_send the order may have executed. - [MT4 error 1: No error returned, but the result is unknown (ERR_NO_RESULT)](https://tickwire.io/metatrader-errors/mt4-1-no-result/): On OrderModify it usually means you sent the values the order already has. On a send or close it means the outcome is unknown. - [MT4 error 2: Common error (ERR_COMMON_ERROR)](https://tickwire.io/metatrader-errors/mt4-2-common-error/): MT4's catch-all trade error. It doesn't say whether the order executed, so check open orders and history before sending again. - [MT4 error 3: Invalid trade parameters (ERR_INVALID_TRADE_PARAMETERS)](https://tickwire.io/metatrader-errors/mt4-3-invalid-trade-parameters/): The trade function got parameters that don't make sense, such as a wrong order type or a bad ticket. Nothing was executed. - [MT4 error 4: Trade server is busy (ERR_SERVER_BUSY)](https://tickwire.io/metatrader-errors/mt4-4-server-busy/): The broker's trade server was too busy to take the request. Nothing was executed; wait a little and send it again. - [MT4 error 5: Old version of the client terminal (ERR_OLD_VERSION)](https://tickwire.io/metatrader-errors/mt4-5-old-version/): The broker's server won't accept trades from this terminal build. Update the MT4 terminal and restart it. - [MT4 error 6: No connection with trade server (ERR_NO_CONNECTION)](https://tickwire.io/metatrader-errors/mt4-6-no-connection/): The terminal had no working link to the broker around the time of the request. It may have executed; check before any retry. - [MT4 error 7: Not enough rights (ERR_NOT_ENOUGH_RIGHTS)](https://tickwire.io/metatrader-errors/mt4-7-not-enough-rights/): The account isn't allowed to do this, often because it is signed in with the investor (read only) password. Nothing was executed. - [MT4 error 8: Too frequent requests (ERR_TOO_FREQUENT_REQUESTS)](https://tickwire.io/metatrader-errors/mt4-8-too-frequent-requests/): Your code sent trade requests faster than the broker accepts. Slow down; this request was refused. - [MT4 error 9: Malfunctional trade operation (ERR_MALFUNCTIONAL_TRADE)](https://tickwire.io/metatrader-errors/mt4-9-malfunctional-trade/): A rare MT4 code for a trade operation that went wrong in an unexpected way. Nothing was executed; check the request and the Journal. - [MT4 error 64: Account disabled (ERR_ACCOUNT_DISABLED)](https://tickwire.io/metatrader-errors/mt4-64-account-disabled/): The broker has disabled this trading account. Nothing was executed, and code can't fix it; contact the broker. - [MT4 error 65: Invalid account (ERR_INVALID_ACCOUNT)](https://tickwire.io/metatrader-errors/mt4-65-invalid-account/): The server doesn't accept this account number for trading. It may be wrong, closed, or on another server. - [MT4 error 128: Trade timeout (ERR_TRADE_TIMEOUT)](https://tickwire.io/metatrader-errors/mt4-128-trade-timeout/): The terminal stopped waiting for the broker's answer. The order may still have executed, so check before you send it again. - [MT4 error 129: Invalid price (ERR_INVALID_PRICE)](https://tickwire.io/metatrader-errors/mt4-129-invalid-price/): The price in the request is stale, on the wrong side, or not normalized. Nothing was executed; refresh rates and resend. - [MT4 error 130: Invalid stops (ERR_INVALID_STOPS)](https://tickwire.io/metatrader-errors/mt4-130-invalid-stops/): The stop loss, take profit or pending price is too close to the market or on the wrong side. Nothing was executed; widen it. - [MT4 error 131: Invalid trade volume (ERR_INVALID_TRADE_VOLUME)](https://tickwire.io/metatrader-errors/mt4-131-invalid-trade-volume/): The lot size is below the minimum, above the maximum or off the lot step. Nothing was executed; round the volume and resend. - [MT4 error 132: Market is closed (ERR_MARKET_CLOSED)](https://tickwire.io/metatrader-errors/mt4-132-market-closed/): The symbol isn't trading right now: a weekend, a holiday or a daily break. Nothing was executed; wait for the session. - [MT4 error 133: Trade is disabled (ERR_TRADE_DISABLED)](https://tickwire.io/metatrader-errors/mt4-133-trade-disabled/): Trading is switched off for this symbol or account. Nothing was executed; retrying won't help until the broker changes it. - [MT4 error 134: Not enough money (ERR_NOT_ENOUGH_MONEY)](https://tickwire.io/metatrader-errors/mt4-134-not-enough-money/): The account's free margin can't cover the order. Nothing was executed; reduce the lots or free up margin first. - [MT4 error 135: Price changed (ERR_PRICE_CHANGED)](https://tickwire.io/metatrader-errors/mt4-135-price-changed/): The price moved before the order could be filled. Nothing was executed; refresh rates and send again with the new price. - [MT4 error 136: Off quotes (ERR_OFF_QUOTES)](https://tickwire.io/metatrader-errors/mt4-136-off-quotes/): The broker had no price it would trade at for this request. Nothing was executed; wait for a new tick and try again. - [MT4 error 137: Broker is busy (ERR_BROKER_BUSY)](https://tickwire.io/metatrader-errors/mt4-137-broker-busy/): The broker couldn't handle the request right now. Nothing was executed; wait a moment and send it again. - [MT4 error 138: Requote (ERR_REQUOTE)](https://tickwire.io/metatrader-errors/mt4-138-requote/): The broker offered a new price instead of filling at yours. Nothing was executed; refresh rates and send again. - [MT4 error 139: Order is locked (ERR_ORDER_LOCKED)](https://tickwire.io/metatrader-errors/mt4-139-order-locked/): The order is already being processed, so your request couldn't act on it. The first request may still complete; check first. - [MT4 error 140: Long positions only allowed (ERR_LONG_POSITIONS_ONLY_ALLOWED)](https://tickwire.io/metatrader-errors/mt4-140-long-positions-only/): The broker allows only buy orders on this symbol right now. Your sell order was refused, and nothing was executed. - [MT4 error 141: Too many requests (ERR_TOO_MANY_REQUESTS)](https://tickwire.io/metatrader-errors/mt4-141-too-many-requests/): The terminal sent more requests than the broker allows in a short time. This one was refused; slow down. - [MT4 error 145: Modification denied because order is too close to market (ERR_TRADE_MODIFY_DENIED)](https://tickwire.io/metatrader-errors/mt4-145-modify-denied/): You tried to change an order or its stops while the price was inside the freeze level. Nothing changed; wait for the price to move. - [MT4 error 146: Trade context is busy (ERR_TRADE_CONTEXT_BUSY)](https://tickwire.io/metatrader-errors/mt4-146-trade-context-busy/): Another program in the same MT4 terminal was using the trade context. Nothing was sent; wait for it to free up and retry. - [MT4 error 147: Expirations are denied by broker (ERR_TRADE_EXPIRATION_DENIED)](https://tickwire.io/metatrader-errors/mt4-147-expiration-denied/): The broker doesn't allow expiry times on pending orders. Send the order with expiration 0 and cancel it yourself later. - [MT4 error 148: Too many open and pending orders (ERR_TRADE_TOO_MANY_ORDERS)](https://tickwire.io/metatrader-errors/mt4-148-too-many-orders/): The account has reached the broker's limit on open and pending orders. Nothing was placed; close or delete some first. - [MT4 error 149: Hedging is prohibited (ERR_TRADE_HEDGE_PROHIBITED)](https://tickwire.io/metatrader-errors/mt4-149-hedge-prohibited/): The account doesn't allow a buy and a sell on the same symbol at once. Close the open trade instead of opening the opposite one. - [MT4 error 150: Prohibited by FIFO rules (ERR_TRADE_PROHIBITED_BY_FIFO)](https://tickwire.io/metatrader-errors/mt4-150-prohibited-by-fifo/): The account must close trades in the order they opened (first in, first out). Close the oldest trade on that symbol first. - [MT4 error 4051: Invalid function parameter value (ERR_INVALID_FUNCTION_PARAMVALUE)](https://tickwire.io/metatrader-errors/mt4-4051-invalid-function-parameter-value/): An MQL4 function got an argument it can't use, such as 0 lots, a negative number or a bad ticket. Nothing was sent. - [MT4 error 4105: No order selected (ERR_NO_ORDER_SELECTED)](https://tickwire.io/metatrader-errors/mt4-4105-no-order-selected/): You called an Order function such as OrderTicket() without a successful OrderSelect() first. Select the order, then read it. - [MT4 error 4106: Unknown symbol (ERR_UNKNOWN_SYMBOL)](https://tickwire.io/metatrader-errors/mt4-4106-unknown-symbol/): The symbol name isn't known to this MT4 terminal. Brokers often use suffixes like EURUSDm, so match the exact name. - [MT4 error 4107: Invalid price parameter for trade function (ERR_INVALID_PRICE_PARAM)](https://tickwire.io/metatrader-errors/mt4-4107-invalid-price-parameter/): The terminal refused the price you passed to a trade function, often because it isn't normalized. Nothing was sent. - [MT4 error 4108: Invalid ticket (ERR_INVALID_TICKET)](https://tickwire.io/metatrader-errors/mt4-4108-invalid-ticket/): The ticket number doesn't match an order the trade function can act on. It may be closed, deleted, or never existed. - [MT4 error 4109: Trade is not allowed (ERR_TRADE_NOT_ALLOWED)](https://tickwire.io/metatrader-errors/mt4-4109-trade-not-allowed/): Trading is switched off in the terminal: the AutoTrading button is off, or live trading is off for this program. Nothing was sent. - [MT4 error 4110: Longs are not allowed (ERR_LONGS_NOT_ALLOWED)](https://tickwire.io/metatrader-errors/mt4-4110-longs-not-allowed/): The program's settings allow only short trades, so a buy was blocked in the terminal. Nothing was sent. - [MT4 error 4111: Shorts are not allowed (ERR_SHORTS_NOT_ALLOWED)](https://tickwire.io/metatrader-errors/mt4-4111-shorts-not-allowed/): The program's settings allow only long trades, so a sell was blocked in the terminal. Nothing was sent. - [MT4 error 4112: Automated trading disabled by trade server (ERR_TRADE_EXPERT_DISABLED_BY_SERVER)](https://tickwire.io/metatrader-errors/mt4-4112-autotrading-disabled-by-server/): The broker's server doesn't allow automated trading on this account. Turning on AutoTrading won't help; ask the broker. - [MT4 error 4200: Object already exists (ERR_OBJECT_ALREADY_EXISTS)](https://tickwire.io/metatrader-errors/mt4-4200-object-already-exists/): ObjectCreate() was called with a name that is already on the chart. Check with ObjectFind() first, or move the existing object. ## Optional Error codes, one page each: - [above_max_lots](https://tickwire.io/docs/errors/above_max_lots.md): Signal webhook: the trade is bigger than the webhook's max lots per order. - [above_max_risk](https://tickwire.io/docs/errors/above_max_risk.md): Signal webhook: the trade would lose more than the webhook's max risk at its stop loss. - [accepted](https://tickwire.io/docs/errors/accepted.md): The same request is still being processed. - [AcceptedError](https://tickwire.io/docs/errors/acceptederror.md): Error name for a request that is still being processed (`/users/current/…` routes only). - [access_denied](https://tickwire.io/docs/errors/access_denied.md): OAuth (Sign in with Tickwire): the user pressed Cancel on the consent page (sent to the app's redirect URI). - [account_conflict](https://tickwire.io/docs/errors/account_conflict.md): Used between Tickwire's own services; the public API does not return it. - [account_deploying](https://tickwire.io/docs/errors/account_deploying.md): The account's terminal is starting. - [account_forbidden](https://tickwire.io/docs/errors/account_forbidden.md): This token is scoped to other accounts. - [account_not_deployed](https://tickwire.io/docs/errors/account_not_deployed.md): The account exists but has no running terminal, so it cannot take this call. The answer carries the account's state and reasonCode. - [account_not_found](https://tickwire.io/docs/errors/account_not_found.md): No trading account with this id belongs to you. - [account_unreachable](https://tickwire.io/docs/errors/account_unreachable.md): The account's terminal could not be reached. - [action_required](https://tickwire.io/docs/errors/action_required.md): Signal webhook: the alert has no action. - [admin_disabled](https://tickwire.io/docs/errors/admin_disabled.md): Status page: the admin API is switched off. - [admin_required](https://tickwire.io/docs/errors/admin_required.md): This page is for Tickwire operators only. - [affiliate_code_inactive](https://tickwire.io/docs/errors/affiliate_code_inactive.md): The affiliate code is paused or removed. - [affiliate_not_active](https://tickwire.io/docs/errors/affiliate_not_active.md): Your affiliate code is not active, so it can't be changed. - [affiliate_removed](https://tickwire.io/docs/errors/affiliate_removed.md): Admin: a removed affiliate can't be paused or resumed. - [agent_gateway_misconfigured](https://tickwire.io/docs/errors/agent_gateway_misconfigured.md): The agent API is not available right now. - [agent_key_not_found](https://tickwire.io/docs/errors/agent_key_not_found.md): No agent key with this id exists in your organisation. - [alert_time_required](https://tickwire.io/docs/errors/alert_time_required.md): Signal webhook: this webhook has a max alert age, so the alert must say when it fired. - [alert_too_old](https://tickwire.io/docs/errors/alert_too_old.md): Signal webhook: the alert is older than the webhook's max alert age. - [already_affiliate](https://tickwire.io/docs/errors/already_affiliate.md): You have already joined the affiliate program. - [already_member](https://tickwire.io/docs/errors/already_member.md): The person is already a member of the organisation. - [already_subscribed](https://tickwire.io/docs/errors/already_subscribed.md): The organisation already has a subscription. - [amount_not_whole_rows](https://tickwire.io/docs/errors/amount_not_whole_rows.md): Admin: a payout must cover whole earnings, oldest first. - [api_key_expired](https://tickwire.io/docs/errors/api_key_expired.md): The API token that sent this order has expired. - [api_key_revoked](https://tickwire.io/docs/errors/api_key_revoked.md): The API key or token that sent this order was revoked or deleted. - [api_version_unsupported](https://tickwire.io/docs/errors/api_version_unsupported.md): The API version to pin is older than the oldest supported version. - [ApiError](https://tickwire.io/docs/errors/apierror.md): Error name on the `/users/current/…` routes for a client error that has no more specific name. - [approval_belongs_to_the_hook](https://tickwire.io/docs/errors/approval_belongs_to_the_hook.md): Only the pre-trade hook that placed a hold can approve it. - [authorization_server_unreachable](https://tickwire.io/docs/errors/authorization_server_unreachable.md): The MCP endpoint could not reach the Tickwire sign-in service to check the access token. - [authorization_unavailable](https://tickwire.io/docs/errors/authorization_unavailable.md): The Tickwire sign-in service could not check the access token right now. - [backend_error](https://tickwire.io/docs/errors/backend_error.md): The terminal returned an error for this operation; the MetaTrader code is in `code` or `mt5Code`. - [bad_code](https://tickwire.io/docs/errors/bad_code.md): The affiliate code has the wrong format. - [bad_code_format](https://tickwire.io/docs/errors/bad_code_format.md): Admin: the promo code name is not valid. - [bad_dates](https://tickwire.io/docs/errors/bad_dates.md): Admin: the promo code's dates are not valid. - [bad_discount_code](https://tickwire.io/docs/errors/bad_discount_code.md): The discount code is unknown or can't be used here. - [bad_email](https://tickwire.io/docs/errors/bad_email.md): The payout email is not a valid address. - [bad_gateway](https://tickwire.io/docs/errors/bad_gateway.md): An upstream service gave an invalid answer. - [bad_path](https://tickwire.io/docs/errors/bad_path.md): The request path is malformed. - [bad_percent](https://tickwire.io/docs/errors/bad_percent.md): Admin: the promo code's percent is not valid. - [bad_request](https://tickwire.io/docs/errors/bad_request.md): The request is malformed. - [bad_response](https://tickwire.io/docs/errors/bad_response.md): The Tickwire API answered the MCP tool without a JSON body. - [bad_signature](https://tickwire.io/docs/errors/bad_signature.md): A billing webhook's signature did not verify. - [below_minimum](https://tickwire.io/docs/errors/below_minimum.md): Admin: the payout is below the minimum. - [body_too_large](https://tickwire.io/docs/errors/body_too_large.md): The request body exceeds the limit for this endpoint. - [bridge_token_key_missing](https://tickwire.io/docs/errors/bridge_token_key_missing.md): Used between Tickwire's own services; the public API does not return it. - [broker_offset_unknown](https://tickwire.io/docs/errors/broker_offset_unknown.md): The broker's UTC offset is not known yet, so UTC times can't be given. - [broker_time_unknown](https://tickwire.io/docs/errors/broker_time_unknown.md): The broker's server time is not known yet. - [busy](https://tickwire.io/docs/errors/busy.md): Used between Tickwire's own services; the public API does not return it. - [canary_not_found](https://tickwire.io/docs/errors/canary_not_found.md): Status page: no webhook-delivery canary has this id. - [candle_unavailable](https://tickwire.io/docs/errors/candle_unavailable.md): No candle is available for this symbol and timeframe. - [checkout_unavailable](https://tickwire.io/docs/errors/checkout_unavailable.md): Payments are not available right now. - [code_change_too_soon](https://tickwire.io/docs/errors/code_change_too_soon.md): You can change your affiliate code once every 30 days. - [code_from_config](https://tickwire.io/docs/errors/code_from_config.md): Admin: this code is set in the configuration, so the admin page can't change it. - [code_reserved](https://tickwire.io/docs/errors/code_reserved.md): That affiliate code is reserved. - [code_taken](https://tickwire.io/docs/errors/code_taken.md): That affiliate code is already used. - [component_not_found](https://tickwire.io/docs/errors/component_not_found.md): Status page: no component with this id. - [conflict](https://tickwire.io/docs/errors/conflict.md): The request conflicts with the current state. - [ConflictError](https://tickwire.io/docs/errors/conflicterror.md): Error name for a conflict (409) on the `/users/current/…` routes. - [conflicting_fields](https://tickwire.io/docs/errors/conflicting_fields.md): Signal webhook: the alert has fields that contradict each other. - [connected_app_not_found](https://tickwire.io/docs/errors/connected_app_not_found.md): OAuth (Sign in with Tickwire): no such connected app in this organisation. - [consent_token_invalid](https://tickwire.io/docs/errors/consent_token_invalid.md): OAuth (Sign in with Tickwire): the approval did not come from the consent page this session opened (CSRF protection). - [controlplane_unavailable](https://tickwire.io/docs/errors/controlplane_unavailable.md): We could not check your token or route the request. - [controlplane_unreachable](https://tickwire.io/docs/errors/controlplane_unreachable.md): Used between Tickwire's own services; the public API does not return it. - [credential_error](https://tickwire.io/docs/errors/credential_error.md): Used between Tickwire's own services; the public API does not return it. - [credential_unreadable](https://tickwire.io/docs/errors/credential_unreadable.md): The account's stored broker password can't be read, so the account can't be deployed. - [dedicated_ip_refused](https://tickwire.io/docs/errors/dedicated_ip_refused.md): The dedicated-IP change can't be made. - [depth_unavailable](https://tickwire.io/docs/errors/depth_unavailable.md): The terminal has no market depth for this symbol. - [discount_code_expired](https://tickwire.io/docs/errors/discount_code_expired.md): The discount code has ended. - [discount_code_not_started](https://tickwire.io/docs/errors/discount_code_not_started.md): The discount code has not started yet. - [discount_too_large](https://tickwire.io/docs/errors/discount_too_large.md): The discount code gives more off than allowed. - [disposable_email](https://tickwire.io/docs/errors/disposable_email.md): Sign-up needs a permanent e-mail address; this one is from a throwaway e-mail service. - [docs_unavailable](https://tickwire.io/docs/errors/docs_unavailable.md): The MCP docs search could not fetch the Tickwire docs. - [driver_error](https://tickwire.io/docs/errors/driver_error.md): Used between Tickwire's own services; the public API does not return it. - [duplicate](https://tickwire.io/docs/errors/duplicate.md): This already exists. - [duplicate_code](https://tickwire.io/docs/errors/duplicate_code.md): Admin: a code with this name already exists. - [egress_in_use](https://tickwire.io/docs/errors/egress_in_use.md): Used between Tickwire's own services; the public API does not return it. - [egress_unavailable](https://tickwire.io/docs/errors/egress_unavailable.md): Used between Tickwire's own services; the public API does not return it. - [email_link_failed](https://tickwire.io/docs/errors/email_link_failed.md): The sign-in, verify or reset email could not be made or sent. - [email_not_verified](https://tickwire.io/docs/errors/email_not_verified.md): Verify your email first. - [email_notifications_unavailable](https://tickwire.io/docs/errors/email_notifications_unavailable.md): Status page: email updates are not available yet. - [email_taken](https://tickwire.io/docs/errors/email_taken.md): An account with this email already exists. - [endpoint_deleted](https://tickwire.io/docs/errors/endpoint_deleted.md): A webhook delivery was abandoned because its endpoint was deleted (the delivery's `error`, not an HTTP status). - [endpoint_disabled](https://tickwire.io/docs/errors/endpoint_disabled.md): A webhook delivery was abandoned because its endpoint is disabled (the delivery's `error`, not an HTTP status). - [event_expired](https://tickwire.io/docs/errors/event_expired.md): A webhook delivery was abandoned because the event is past its retention (the delivery's `error`, not an HTTP status). - [event_ingest_unavailable](https://tickwire.io/docs/errors/event_ingest_unavailable.md): Used between Tickwire's own services; the public API does not return it. - [event_scope_mismatch](https://tickwire.io/docs/errors/event_scope_mismatch.md): Used between Tickwire's own services; the public API does not return it. - [event_type_not_allowed](https://tickwire.io/docs/errors/event_type_not_allowed.md): Used between Tickwire's own services; the public API does not return it. - [events_token_invalid](https://tickwire.io/docs/errors/events_token_invalid.md): Used between Tickwire's own services; the public API does not return it. - [execution_unavailable](https://tickwire.io/docs/errors/execution_unavailable.md): A trade sent over streaming could not reach the execution service, so it was not sent (`stringCode` of a streaming `InternalError`). - [forbidden](https://tickwire.io/docs/errors/forbidden.md): Your credential may not do this. - [ForbiddenError](https://tickwire.io/docs/errors/forbiddenerror.md): Error name for a forbidden request (403) on the `/users/current/…` routes. - [gateway_timeout](https://tickwire.io/docs/errors/gateway_timeout.md): An upstream did not answer in time. - [hedging_required](https://tickwire.io/docs/errors/hedging_required.md): Signal webhook: this webhook setting needs a hedging account, and this is an MT5 netting account. - [hold_expired](https://tickwire.io/docs/errors/hold_expired.md): A held order expired before a decision; it was not and will not be executed. - [hold_not_found](https://tickwire.io/docs/errors/hold_not_found.md): No such hold. - [hold_rejected](https://tickwire.io/docs/errors/hold_rejected.md): A held order was rejected by the pre-trade hook or the owner; nothing was sent. - [hook_denied](https://tickwire.io/docs/errors/hook_denied.md): The account owner's pre-trade hook denied this order; nothing was sent. - [hook_exists](https://tickwire.io/docs/errors/hook_exists.md): This account or agent key already has a pre-trade hook. - [hook_not_found](https://tickwire.io/docs/errors/hook_not_found.md): No such pre-trade hook. - [hook_not_holding](https://tickwire.io/docs/errors/hook_not_holding.md): This hook did not place this hold. - [hook_unavailable](https://tickwire.io/docs/errors/hook_unavailable.md): The pre-trade hook didn't give a valid answer. The hook fails closed, so the order wasn't sent. - [host_monitor_unknown](https://tickwire.io/docs/errors/host_monitor_unknown.md): Used between Tickwire's own services; the public API does not return it. - [host_outage](https://tickwire.io/docs/errors/host_outage.md): Used between Tickwire's own services; the public API does not return it. - [host_retired](https://tickwire.io/docs/errors/host_retired.md): Used between Tickwire's own services; the public API does not return it. - [host_unknown](https://tickwire.io/docs/errors/host_unknown.md): Used between Tickwire's own services; the public API does not return it. - [http_error](https://tickwire.io/docs/errors/http_error.md): An HTTP error with no more specific code. - [idempotency_conflict](https://tickwire.io/docs/errors/idempotency_conflict.md): This Idempotency-Key was already used with a different request body. - [idempotency_in_flight](https://tickwire.io/docs/errors/idempotency_in_flight.md): A request with this Idempotency-Key is still running. This request was not sent (`sent: false`); the earlier one may still execute. - [idempotency_key_required](https://tickwire.io/docs/errors/idempotency_key_required.md): Every trade needs an Idempotency-Key. - [idempotency_key_reused](https://tickwire.io/docs/errors/idempotency_key_reused.md): This Idempotency-Key was used for a different order, account or batch; this request was not sent. - [idempotency_unavailable](https://tickwire.io/docs/errors/idempotency_unavailable.md): Idempotency can't be checked right now, so nothing was sent. - [incident_closed](https://tickwire.io/docs/errors/incident_closed.md): Status page: the incident or maintenance is already resolved or completed. - [incident_not_closed](https://tickwire.io/docs/errors/incident_not_closed.md): Status page: a postmortem can only be written once the incident is resolved. - [incident_not_found](https://tickwire.io/docs/errors/incident_not_found.md): Status page: no incident with this id. - [insufficient_balance](https://tickwire.io/docs/errors/insufficient_balance.md): The wallet balance does not cover this purchase. - [interaction_required](https://tickwire.io/docs/errors/interaction_required.md): OAuth (Sign in with Tickwire): the user has to approve the app on the consent page (shown on the sign-in error page). - [internal_error](https://tickwire.io/docs/errors/internal_error.md): An unexpected failure inside Tickwire. - [InternalError](https://tickwire.io/docs/errors/internalerror.md): Error name for a server-side failure on the `/users/current/…` routes. - [invalid](https://tickwire.io/docs/errors/invalid.md): The subscription frame on the terminal WebSocket (`/{mt4|mt5}/{id}/ws`) is invalid. - [invalid_action](https://tickwire.io/docs/errors/invalid_action.md): Signal webhook: the alert's action is not one Tickwire knows. - [invalid_actor](https://tickwire.io/docs/errors/invalid_actor.md): X-Actor names a server-assigned identity that is not the calling credential's own. Nothing was changed. - [invalid_agent_key](https://tickwire.io/docs/errors/invalid_agent_key.md): The agent key is missing, invalid or revoked. - [invalid_alert_time](https://tickwire.io/docs/errors/invalid_alert_time.md): Signal webhook: the alert's time can't be read. - [invalid_api_version](https://tickwire.io/docs/errors/invalid_api_version.md): The Tickwire-Version header, or the apiVersion to pin, names no published API version. - [invalid_audit_header](https://tickwire.io/docs/errors/invalid_audit_header.md): X-Actor or X-Reason holds characters outside printable ASCII. Nothing was sent or changed. - [invalid_batch](https://tickwire.io/docs/errors/invalid_batch.md): The batch request is invalid; nothing was sent. - [invalid_cancel_reason](https://tickwire.io/docs/errors/invalid_cancel_reason.md): The reason for cancelling is not one of the listed choices, or the note is not text. Nothing was cancelled. - [invalid_client](https://tickwire.io/docs/errors/invalid_client.md): OAuth (Sign in with Tickwire): the client could not be identified or authenticated. - [invalid_client_metadata](https://tickwire.io/docs/errors/invalid_client_metadata.md): OAuth (Sign in with Tickwire): the dynamic client registration request is not acceptable. - [invalid_country](https://tickwire.io/docs/errors/invalid_country.md): The country is not a two-letter ISO 3166-1 code we know. Nothing was changed. - [invalid_credentials](https://tickwire.io/docs/errors/invalid_credentials.md): Email or password is wrong. - [invalid_cursor](https://tickwire.io/docs/errors/invalid_cursor.md): The pagination cursor is not one this list issued. - [invalid_days](https://tickwire.io/docs/errors/invalid_days.md): Admin: days must be a whole number from 1 to 30. - [invalid_egress_ip](https://tickwire.io/docs/errors/invalid_egress_ip.md): Used between Tickwire's own services; the public API does not return it. - [invalid_email](https://tickwire.io/docs/errors/invalid_email.md): The email address is not valid. - [invalid_generation](https://tickwire.io/docs/errors/invalid_generation.md): Used between Tickwire's own services; the public API does not return it. - [invalid_grant](https://tickwire.io/docs/errors/invalid_grant.md): OAuth (Sign in with Tickwire): the authorization code, refresh token or access token is not valid for this request. - [invalid_hook](https://tickwire.io/docs/errors/invalid_hook.md): The pre-trade hook definition is invalid. - [invalid_hook_url](https://tickwire.io/docs/errors/invalid_hook_url.md): The pre-trade hook URL is not allowed. - [invalid_idempotency_key](https://tickwire.io/docs/errors/invalid_idempotency_key.md): The Idempotency-Key (or `transaction-id` header) is longer than 255 characters or holds characters outside printable ASCII. Nothing was changed. - [invalid_incident_status](https://tickwire.io/docs/errors/invalid_incident_status.md): Status page: that status doesn't belong to this kind of event. - [invalid_json](https://tickwire.io/docs/errors/invalid_json.md): Signal webhook: the alert body is not a JSON object. - [invalid_link](https://tickwire.io/docs/errors/invalid_link.md): The sign-in or invite link is invalid or expired. - [invalid_maintenance](https://tickwire.io/docs/errors/invalid_maintenance.md): Status page: the maintenance window is invalid. - [invalid_message](https://tickwire.io/docs/errors/invalid_message.md): A WebSocket frame is not a valid message (sent as an error frame, not an HTTP status). - [invalid_order](https://tickwire.io/docs/errors/invalid_order.md): The order is invalid; nothing was sent. - [invalid_parameter](https://tickwire.io/docs/errors/invalid_parameter.md): A query or path parameter is invalid; `details` names it. - [invalid_redirect_uri](https://tickwire.io/docs/errors/invalid_redirect_uri.md): OAuth (Sign in with Tickwire): a registered redirect URI is not allowed. - [invalid_request](https://tickwire.io/docs/errors/invalid_request.md): The request body is invalid. - [invalid_scope](https://tickwire.io/docs/errors/invalid_scope.md): OAuth (Sign in with Tickwire): the requested scope is wider than what was granted. - [invalid_signal](https://tickwire.io/docs/errors/invalid_signal.md): Signal webhook: a value in the alert has the wrong type or is out of range. - [invalid_signature](https://tickwire.io/docs/errors/invalid_signature.md): A hold release was not signed with the holding hook's secret. - [invalid_subscription](https://tickwire.io/docs/errors/invalid_subscription.md): A market-data subscription is invalid (sent as an error frame). - [invalid_symbol](https://tickwire.io/docs/errors/invalid_symbol.md): Signal webhook: the alert's symbol is not a symbol name. - [invalid_target](https://tickwire.io/docs/errors/invalid_target.md): OAuth (Sign in with Tickwire): the resource parameter is not the Tickwire MCP server. - [invalid_terms_version](https://tickwire.io/docs/errors/invalid_terms_version.md): The Terms version in the request is not a Terms date. - [invalid_token](https://tickwire.io/docs/errors/invalid_token.md): The token is invalid, expired or revoked. - [invalid_url](https://tickwire.io/docs/errors/invalid_url.md): The webhook URL is not allowed. The message is the same whatever rule refused it. - [ip_allocation_refused](https://tickwire.io/docs/errors/ip_allocation_refused.md): The dedicated-IP operation can't be done in the IP's current state. - [ip_not_allowed](https://tickwire.io/docs/errors/ip_not_allowed.md): The token is valid, but it has an IP allowlist and this request came from an address outside it. The message never shows the allowlist. - [ip_previously_owned](https://tickwire.io/docs/errors/ip_previously_owned.md): A Tickwire customer has held this IP before. Tickwire never reassigns a dedicated IP. - [keyring_missing](https://tickwire.io/docs/errors/keyring_missing.md): Used between Tickwire's own services; the public API does not return it. - [kill_switch_engaged](https://tickwire.io/docs/errors/kill_switch_engaged.md): The kill switch for this account or agent key is engaged; nothing was sent. - [last_owner](https://tickwire.io/docs/errors/last_owner.md): An organisation needs at least one owner. - [length_required](https://tickwire.io/docs/errors/length_required.md): Used between Tickwire's own services; the public API does not return it. - [market_depth_unavailable](https://tickwire.io/docs/errors/market_depth_unavailable.md): The terminal gave no market depth for the symbol (stream error frame). - [max_open_positions_reached](https://tickwire.io/docs/errors/max_open_positions_reached.md): Signal webhook: the webhook already has its max number of open trades. - [method_access](https://tickwire.io/docs/errors/method_access.md): This token may not call this method. - [method_not_allowed](https://tickwire.io/docs/errors/method_not_allowed.md): This HTTP method is not supported on this path. - [missing_agent_key](https://tickwire.io/docs/errors/missing_agent_key.md): The MCP endpoint needs a Tickwire agent key, and none was sent. - [missing_credentials](https://tickwire.io/docs/errors/missing_credentials.md): The MCP endpoint was called without a sign-in or an agent key. - [missing_header](https://tickwire.io/docs/errors/missing_header.md): A required header is missing. - [missing_token](https://tickwire.io/docs/errors/missing_token.md): No token was sent. - [MRPC](https://tickwire.io/docs/errors/mrpc.md): Terminal route error (`/{mt4|mt5}/{id}/…`): the terminal processed the request but the operation failed. - [MRPC_NOT_CONNECTED](https://tickwire.io/docs/errors/mrpc_not_connected.md): Terminal route error (`/{mt4|mt5}/{id}/…`): the terminal has no broker connection right now. - [MRPC_VALIDATION](https://tickwire.io/docs/errors/mrpc_validation.md): Terminal route error (`/{mt4|mt5}/{id}/…`): a parameter is missing or invalid. - [netting_shared_symbol](https://tickwire.io/docs/errors/netting_shared_symbol.md): Signal webhook: on an MT5 netting account, the symbol already has a position this webhook did not open. - [no_alert_channel](https://tickwire.io/docs/errors/no_alert_channel.md): Admin: no alert channel is set up, so the test notice was not sent. - [no_org](https://tickwire.io/docs/errors/no_org.md): No organisation is selected. - [no_subscription](https://tickwire.io/docs/errors/no_subscription.md): There is no subscription to manage yet. - [not_affiliate](https://tickwire.io/docs/errors/not_affiliate.md): You have not joined the affiliate program. - [not_billable](https://tickwire.io/docs/errors/not_billable.md): This account is not billed per account, so it has no own-address switch. - [not_configured](https://tickwire.io/docs/errors/not_configured.md): This feature is not set up on this server. - [not_connected](https://tickwire.io/docs/errors/not_connected.md): The terminal has no broker connection right now. - [not_found](https://tickwire.io/docs/errors/not_found.md): No such endpoint or resource. - [not_implemented](https://tickwire.io/docs/errors/not_implemented.md): This is not implemented here. - [not_ready](https://tickwire.io/docs/errors/not_ready.md): The service is running but its database did not answer the readiness check. - [not_revealable](https://tickwire.io/docs/errors/not_revealable.md): Key values are shown only once, at creation (or rotation), and stored hashed. - [not_subscribed](https://tickwire.io/docs/errors/not_subscribed.md): Unsubscribe without a subscription (stream error frame). - [not_supported](https://tickwire.io/docs/errors/not_supported.md): This terminal backend does not provide the requested stream (stream error frame). - [not_supported_on_mt4](https://tickwire.io/docs/errors/not_supported_on_mt4.md): MetaTrader 4 doesn't support this. - [not_supported_on_mt5](https://tickwire.io/docs/errors/not_supported_on_mt5.md): MetaTrader 5 can't do this. - [not_upgradable](https://tickwire.io/docs/errors/not_upgradable.md): This subscription can't be upgraded right now. - [NotAuthenticatedError](https://tickwire.io/docs/errors/notauthenticatederror.md): Error name in a streaming error: the account's terminal is not connected, or the account is not subscribed on this connection. - [NotConnectedError](https://tickwire.io/docs/errors/notconnectederror.md): Error name on the `/users/current/…` routes: the terminal is not connected to the broker. - [note_too_long](https://tickwire.io/docs/errors/note_too_long.md): The note given when cancelling is longer than 500 characters. Nothing was cancelled. - [NotFoundError](https://tickwire.io/docs/errors/notfounderror.md): Error name for a missing resource on the `/users/current/…` routes. - [nothing_to_change](https://tickwire.io/docs/errors/nothing_to_change.md): The request asked for no change. - [nothing_to_retry](https://tickwire.io/docs/errors/nothing_to_retry.md): There is no failed payment to retry. - [NotSynchronizedError](https://tickwire.io/docs/errors/notsynchronizederror.md): Error name on the `/users/current/…` routes: the terminal is not synchronized enough to answer (for example the broker time is not known yet). - [oauth_not_configured](https://tickwire.io/docs/errors/oauth_not_configured.md): OAuth (Sign in with Tickwire): sign-in for AI apps is not enabled on this deployment. - [one_code_per_customer](https://tickwire.io/docs/errors/one_code_per_customer.md): This organisation already has an affiliate code. - [order_not_found](https://tickwire.io/docs/errors/order_not_found.md): No pending order with this id. - [ordering_not_configured](https://tickwire.io/docs/errors/ordering_not_configured.md): Used between Tickwire's own services; the public API does not return it. - [outcome_unknown](https://tickwire.io/docs/errors/outcome_unknown.md): A trade sent over streaming got no answer from the execution service; it may have executed (`stringCode` of a streaming `InternalError`). - [outside_trading_hours](https://tickwire.io/docs/errors/outside_trading_hours.md): Signal webhook: the alert came outside the webhook's trading hours, so the new trade was not opened. - [own_address_refused](https://tickwire.io/docs/errors/own_address_refused.md): The account could not be moved to its own address, so it stays on the shared address. - [payload_too_large](https://tickwire.io/docs/errors/payload_too_large.md): The request body is too large. - [payment_pending](https://tickwire.io/docs/errors/payment_pending.md): An earlier upgrade's payment is still being confirmed. - [payment_provider_error](https://tickwire.io/docs/errors/payment_provider_error.md): The payment provider failed the call. - [PaymentRequiredError](https://tickwire.io/docs/errors/paymentrequirederror.md): Error name for a request that needs payment (402) on the `/users/current/…` routes. - [pip_size_unavailable](https://tickwire.io/docs/errors/pip_size_unavailable.md): Signal webhook: a stop in pips was asked for a symbol that has no pip size. - [placeholder_not_filled](https://tickwire.io/docs/errors/placeholder_not_filled.md): Signal webhook: a TradingView placeholder in the alert was not filled in. - [ports_exhausted](https://tickwire.io/docs/errors/ports_exhausted.md): Used between Tickwire's own services; the public API does not return it. - [position_not_found](https://tickwire.io/docs/errors/position_not_found.md): No open position with this id. - [postmortem_not_found](https://tickwire.io/docs/errors/postmortem_not_found.md): Status page: this incident has no postmortem. - [pretrade_unavailable](https://tickwire.io/docs/errors/pretrade_unavailable.md): The pre-trade check (pre-trade hooks) could not be completed, so the order was not sent. - [query_token_not_allowed](https://tickwire.io/docs/errors/query_token_not_allowed.md): The API key was sent in the URL of a REST request; keys in the URL are accepted only for WebSockets. - [quote_stale](https://tickwire.io/docs/errors/quote_stale.md): A market order was refused before sending because its symbol's quote is not moving. - [quote_unavailable](https://tickwire.io/docs/errors/quote_unavailable.md): The symbol exists, but the terminal has no live bid and ask for it yet. - [rate_limited](https://tickwire.io/docs/errors/rate_limited.md): Too many requests. - [read_only_key](https://tickwire.io/docs/errors/read_only_key.md): This key is read-only; it can't trade. - [read_only_token](https://tickwire.io/docs/errors/read_only_token.md): This token is read-only. - [reason_required](https://tickwire.io/docs/errors/reason_required.md): Every trade needs a reason (X-Reason). - [reason_too_long](https://tickwire.io/docs/errors/reason_too_long.md): The reason is too long. - [reference_required](https://tickwire.io/docs/errors/reference_required.md): Admin: a payout needs a payment reference. - [request_belongs_to_someone_else](https://tickwire.io/docs/errors/request_belongs_to_someone_else.md): OAuth (Sign in with Tickwire): this sign-in request was opened by another signed-in user first. - [request_body_timeout](https://tickwire.io/docs/errors/request_body_timeout.md): The request body did not arrive in time; nothing was forwarded. - [request_expired](https://tickwire.io/docs/errors/request_expired.md): OAuth (Sign in with Tickwire): the sign-in request is older than 10 minutes. - [request_header_fields_too_large](https://tickwire.io/docs/errors/request_header_fields_too_large.md): Used between Tickwire's own services; the public API does not return it. - [request_log_not_found](https://tickwire.io/docs/errors/request_log_not_found.md): There is no request log entry with this id in your organisation. - [request_not_found](https://tickwire.io/docs/errors/request_not_found.md): No trade was recorded under this Idempotency-Key. - [request_not_supported](https://tickwire.io/docs/errors/request_not_supported.md): OAuth (Sign in with Tickwire): request objects (request, request_uri) are not supported (shown on the sign-in error page). - [request_used](https://tickwire.io/docs/errors/request_used.md): OAuth (Sign in with Tickwire): the sign-in request was already answered. - [resend_window_expired](https://tickwire.io/docs/errors/resend_window_expired.md): The webhook event is too old to resend. - [retry_limited](https://tickwire.io/docs/errors/retry_limited.md): Too many payment retries in a short time. - [sandbox_account_limit](https://tickwire.io/docs/errors/sandbox_account_limit.md): Your sandbox already holds its maximum number of accounts (5 by default). - [sandbox_key_limit](https://tickwire.io/docs/errors/sandbox_key_limit.md): Your sandbox already holds its maximum number of active credentials of this kind (5 sandbox keys; 20 each of API tokens, read-only keys and agent keys by default). - [sandbox_key_required](https://tickwire.io/docs/errors/sandbox_key_required.md): Server Tickwire-Sandbox is only for sandbox keys; sandbox and live never mix. - [sandbox_key_restricted](https://tickwire.io/docs/errors/sandbox_key_restricted.md): This sandbox key came from anonymous sign-up: it may manage its sandbox accounts, trade, stream and read, nothing else. - [sandbox_server_required](https://tickwire.io/docs/errors/sandbox_server_required.md): A sandbox key can only create simulated accounts. - [self_referral](https://tickwire.io/docs/errors/self_referral.md): You can't use your own affiliate code. - [server_limit_reached](https://tickwire.io/docs/errors/server_limit_reached.md): The maximum number of private servers is reached. - [service_unavailable](https://tickwire.io/docs/errors/service_unavailable.md): The service is not available right now. - [side_not_allowed](https://tickwire.io/docs/errors/side_not_allowed.md): Signal webhook: the webhook only opens trades on the other side. - [sign_in_required](https://tickwire.io/docs/errors/sign_in_required.md): This invite link only works once you are signed in with the invited email address. - [signal_in_flight](https://tickwire.io/docs/errors/signal_in_flight.md): Signal webhook: this alert is still being handled by an earlier delivery. - [signal_webhook_not_found](https://tickwire.io/docs/errors/signal_webhook_not_found.md): Signal webhook: no such signal webhook. - [signal_webhook_paused](https://tickwire.io/docs/errors/signal_webhook_paused.md): Signal webhook: the signal webhook is paused. - [signal_webhook_revoked](https://tickwire.io/docs/errors/signal_webhook_revoked.md): Signal webhook: the signal webhook was revoked. - [size_below_min_volume](https://tickwire.io/docs/errors/size_below_min_volume.md): Signal webhook: the trade size is below the symbol's minimum volume. - [slots_full](https://tickwire.io/docs/errors/slots_full.md): Every purchased slot is taken. - [spread_too_wide](https://tickwire.io/docs/errors/spread_too_wide.md): Signal webhook: the spread is wider than the webhook allows, so the new trade was not opened. - [stop_loss_required](https://tickwire.io/docs/errors/stop_loss_required.md): Signal webhook: the trade needs a stop loss and the alert has none. - [stop_too_close](https://tickwire.io/docs/errors/stop_too_close.md): Signal webhook: the stop loss or take profit is too close to the current price. - [stop_wrong_side](https://tickwire.io/docs/errors/stop_wrong_side.md): Signal webhook: the stop loss or take profit is on the wrong side of the current price. - [subscription_canceled](https://tickwire.io/docs/errors/subscription_canceled.md): The subscription is canceled, so it can't be upgraded or charged again. - [symbol_not_allowed](https://tickwire.io/docs/errors/symbol_not_allowed.md): Signal webhook: the symbol is not in the webhook's allowed_symbols. - [symbol_not_found](https://tickwire.io/docs/errors/symbol_not_found.md): The terminal doesn't know this symbol. - [symbol_required](https://tickwire.io/docs/errors/symbol_required.md): Signal webhook: the alert has no symbol. - [take_profit_required](https://tickwire.io/docs/errors/take_profit_required.md): Signal webhook: move_tp needs a take profit and the alert has none. - [temporarily_unavailable](https://tickwire.io/docs/errors/temporarily_unavailable.md): The service could not answer just now. A read changed nothing; for a change, `changed: unknown` means it may or may not have been saved. - [terminal_event_value_invalid](https://tickwire.io/docs/errors/terminal_event_value_invalid.md): Used between Tickwire's own services; the public API does not return it. - [terminal_events_disabled](https://tickwire.io/docs/errors/terminal_events_disabled.md): Used between Tickwire's own services; the public API does not return it. - [terminal_timeout](https://tickwire.io/docs/errors/terminal_timeout.md): The terminal did not answer a read in time. - [terminal_unavailable](https://tickwire.io/docs/errors/terminal_unavailable.md): Signal webhook: the terminal did not answer a read the plan needs. - [terms_outdated](https://tickwire.io/docs/errors/terms_outdated.md): The affiliate terms have changed. - [terms_required](https://tickwire.io/docs/errors/terms_required.md): Accept the affiliate terms to join. - [tick_value_unavailable](https://tickwire.io/docs/errors/tick_value_unavailable.md): Signal webhook: the terminal gave no tick value for the symbol, so the loss at the stop can't be worked out. - [TICKWIRE_HELD](https://tickwire.io/docs/errors/tickwire_held.md): A pre-trade hook is holding this order; nothing has been sent yet (`stringCode` of a streaming `TradeError`). - [tickwire_no_reply](https://tickwire.io/docs/errors/tickwire_no_reply.md): The MCP tool sent the request but got no reply. If it was a trade, it may have executed. - [tickwire_unreachable](https://tickwire.io/docs/errors/tickwire_unreachable.md): The MCP tool could not reach the Tickwire API, so nothing was sent. - [timeout](https://tickwire.io/docs/errors/timeout.md): No answer in time: a batch leg's status, or a pre-trade hook's `error` in webhook events. For a batch leg the order may have executed. - [TimeoutError](https://tickwire.io/docs/errors/timeouterror.md): Error name in a streaming error: the terminal did not answer in time. - [too_few_accounts](https://tickwire.io/docs/errors/too_few_accounts.md): Fewer accounts were chosen than are deployed now. - [too_many_attempts](https://tickwire.io/docs/errors/too_many_attempts.md): Too many failed sign-ins or link requests. - [too_many_connections](https://tickwire.io/docs/errors/too_many_connections.md): Too many concurrent WebSockets for this token. - [too_many_positions](https://tickwire.io/docs/errors/too_many_positions.md): Signal webhook: the alert would need more than 20 orders. - [too_many_requests](https://tickwire.io/docs/errors/too_many_requests.md): Too many requests of one kind at once: market-data slots for an account, or sign-in emails. - [too_many_sessions](https://tickwire.io/docs/errors/too_many_sessions.md): Too many stream sessions for this account (error frame, then the socket closes). - [TooManyRequestsError](https://tickwire.io/docs/errors/toomanyrequestserror.md): Error name for a rate limit on the `/users/current/…` routes; `metadata.recommendedRetryTime` says when to retry. - [topic_locked](https://tickwire.io/docs/errors/topic_locked.md): This kind of email can not be turned off. - [TradeError](https://tickwire.io/docs/errors/tradeerror.md): Error name in a streaming error: the trade was refused or is being held. `stringCode` says which, and `metadata.sent` says whether anything reached the broker. - [unauthorized](https://tickwire.io/docs/errors/unauthorized.md): Missing or invalid credentials. - [UnauthorizedError](https://tickwire.io/docs/errors/unauthorizederror.md): Error name for a missing or invalid token on the `/users/current/…` routes. - [unavailable](https://tickwire.io/docs/errors/unavailable.md): A dependent feature isn't running right now. - [unknown_account](https://tickwire.io/docs/errors/unknown_account.md): An account id in the request is not yours. - [unknown_actor](https://tickwire.io/docs/errors/unknown_actor.md): The original caller of a held order can't be verified; nothing was sent. - [unknown_component](https://tickwire.io/docs/errors/unknown_component.md): Status page: an incident names a component that doesn't exist. - [unknown_event_type](https://tickwire.io/docs/errors/unknown_event_type.md): The webhook event type is not in the event catalog. - [unknown_field](https://tickwire.io/docs/errors/unknown_field.md): The trade body has a field the trade route does not know, so nothing was sent. It is the `code` of a ValidationError. - [unknown_host](https://tickwire.io/docs/errors/unknown_host.md): No Tickwire service is served at this hostname. - [unknown_platform](https://tickwire.io/docs/errors/unknown_platform.md): Used between Tickwire's own services; the public API does not return it. - [unknown_region](https://tickwire.io/docs/errors/unknown_region.md): This region is not served. - [unknown_topic](https://tickwire.io/docs/errors/unknown_topic.md): The email notification topic does not exist. - [unreachable_account](https://tickwire.io/docs/errors/unreachable_account.md): Some accounts in the batch have no terminal; nothing was sent. - [unsupported_grant_type](https://tickwire.io/docs/errors/unsupported_grant_type.md): OAuth (Sign in with Tickwire): the token endpoint only supports authorization_code and refresh_token. - [unsupported_media_type](https://tickwire.io/docs/errors/unsupported_media_type.md): The request body has an unsupported content type. - [unsupported_response_type](https://tickwire.io/docs/errors/unsupported_response_type.md): OAuth (Sign in with Tickwire): only response_type=code is supported (shown on the sign-in error page). - [upstream_misconfigured](https://tickwire.io/docs/errors/upstream_misconfigured.md): The account's terminal refused our API. - [upstream_refused](https://tickwire.io/docs/errors/upstream_refused.md): The upstream refused the WebSocket. - [upstream_timeout](https://tickwire.io/docs/errors/upstream_timeout.md): The upstream did not answer in time. For a mutating request the outcome is unknown (`metadata.outcome: unknown`): it may have executed. - [upstream_unavailable](https://tickwire.io/docs/errors/upstream_unavailable.md): A Tickwire service is unreachable; the request was not sent. - [url_not_allowed](https://tickwire.io/docs/errors/url_not_allowed.md): A webhook delivery was not sent because the endpoint's URL failed our egress rules at send time (the delivery's `lastError`, and an endpoint's `disabledReason`; not an HTTP status). - [validation_error](https://tickwire.io/docs/errors/validation_error.md): The request failed validation. - [ValidationError](https://tickwire.io/docs/errors/validationerror.md): Error name for an invalid request on the `/users/current/…` routes; `details` lists the parameters. - [volume_required](https://tickwire.io/docs/errors/volume_required.md): Signal webhook: the alert has no size and the webhook has no default lots. - [waking_up](https://tickwire.io/docs/errors/waking_up.md): Tickwire was paused to save cost while nobody was using it, and your request started it again. Starting takes about 2 minutes. - [weak_password](https://tickwire.io/docs/errors/weak_password.md): The password is too weak. - [webhook_trigger_sandbox_only](https://tickwire.io/docs/errors/webhook_trigger_sandbox_only.md): On a live key only webhook.test can be triggered; other test events are sandbox-only. - [webhook_unavailable](https://tickwire.io/docs/errors/webhook_unavailable.md): The test event was published, but the webhook pipeline could not store or queue it, so your endpoints will not receive it. - [window_too_large](https://tickwire.io/docs/errors/window_too_large.md): The time window is too large for one call.