MetaTrader5 Python Documentation Search
Search the official MQL5 documentation at https://www.mql5.com/en/docs/python_metatrader5 for MetaTrader5 Python package usage.
Agent-Agnostic Compatibility
- Prefer the agent's native web-fetch capability (for example:
WebFetch, browser tool, or built-in URL retrieval).
- If no native fetch tool exists, use CLI fallback (
curl or wget) to retrieve docs pages.
- If network access is blocked, state the limitation and provide the best guidance from known MT5 docs structure.
Procedure
- Identify the MT5 Python function(s) relevant to the user's query.
- Fetch the corresponding documentation page(s) using the available web retrieval method.
- Summarize the function signature, parameters, return value, and usage examples.
- If the user's query is general or unclear, fetch the index page first to find the right function.
Documentation URL Map
Base URL: https://www.mql5.com/en/docs/python_metatrader5
| Function |
URL Path |
initialize |
/mt5initialize_py |
login |
/mt5login_py |
shutdown |
/mt5shutdown_py |
version |
/mt5version_py |
last_error |
/mt5lasterror_py |
account_info |
/mt5accountinfo_py |
terminal_info |
/mt5terminalinfo_py |
symbols_total |
/mt5symbolstotal_py |
symbols_get |
/mt5symbolsget_py |
symbol_info |
/mt5symbolinfo_py |
symbol_info_tick |
/mt5symbolinfotick_py |
symbol_select |
/mt5symbolselect_py |
market_book_add |
/mt5marketbookadd_py |
market_book_get |
/mt5marketbookget_py |
market_book_release |
/mt5marketbookrelease_py |
copy_rates_from |
/mt5copyratesfrom_py |
copy_rates_from_pos |
/mt5copyratesfrompos_py |
copy_rates_range |
/mt5copyratesrange_py |
copy_ticks_from |
/mt5copyticksfrom_py |
copy_ticks_range |
/mt5copyticksrange_py |
orders_total |
/mt5orderstotal_py |
orders_get |
/mt5ordersget_py |
order_calc_margin |
/mt5ordercalcmargin_py |
order_calc_profit |
/mt5ordercalcprofit_py |
order_check |
/mt5ordercheck_py |
order_send |
/mt5ordersend_py |
positions_total |
/mt5positionstotal_py |
positions_get |
/mt5positionsget_py |
history_orders_total |
/mt5historyorderstotal_py |
history_orders_get |
/mt5historyordersget_py |
history_deals_total |
/mt5historydealstotal_py |
history_deals_get |
/mt5historydealsget_py |
Function Categories
Use these categories to narrow down the user's query:
- Connection:
initialize, login, shutdown
- Information:
version, last_error, account_info, terminal_info
- Symbols:
symbols_total, symbols_get, symbol_info, symbol_info_tick, symbol_select
- Market Depth:
market_book_add, market_book_get, market_book_release
- Market Data:
copy_rates_from, copy_rates_from_pos, copy_rates_range, copy_ticks_from, copy_ticks_range
- Orders:
orders_total, orders_get, order_calc_margin, order_calc_profit, order_check, order_send
- Positions:
positions_total, positions_get
- History:
history_orders_total, history_orders_get, history_deals_total, history_deals_get
Fetching Documentation
For each relevant function, retrieve its documentation using whichever method the agent supports:
- Native fetch tools (preferred).
- Browser automation tools.
- Shell fallback, for example:
curl -fsSL "https://www.mql5.com/en/docs/python_metatrader5<url_path>"
Extraction target for each page:
- Function signature with all parameters.
- Parameter descriptions and types.
- Return value description.
- Notes/remarks.
- Full code example.
When the query spans multiple functions, fetch pages in parallel when the agent/tooling supports it.
Response Format
Present the results as:
- Function:
MetaTrader5.function_name()
- Description: What the function does
- Signature: Full call signature with parameters
- Parameters: Table or list of parameter names, types, and descriptions
- Returns: Return type and description
- Example: Code example from the documentation
- Source: Link to the official documentation page
1---2name: metatrader5-docs3description: Search the official MQL5 documentation for MetaTrader5 Python package usage. Use when the user needs help with MT5 Python API functions, parameters, return values, or usage examples.4---56# MetaTrader5 Python Documentation Search78Search the official MQL5 documentation at `https://www.mql5.com/en/docs/python_metatrader5` for MetaTrader5 Python package usage.910## Agent-Agnostic Compatibility1112- Prefer the agent's native web-fetch capability (for example: `WebFetch`, browser tool, or built-in URL retrieval).13- If no native fetch tool exists, use CLI fallback (`curl` or `wget`) to retrieve docs pages.14- If network access is blocked, state the limitation and provide the best guidance from known MT5 docs structure.1516## Procedure17181. Identify the MT5 Python function(s) relevant to the user's query.192. Fetch the corresponding documentation page(s) using the available web retrieval method.203. Summarize the function signature, parameters, return value, and usage examples.214. If the user's query is general or unclear, fetch the index page first to find the right function.2223## Documentation URL Map2425Base URL: `https://www.mql5.com/en/docs/python_metatrader5`2627| Function | URL Path |28| ---------------------- | --------------------------- |29| `initialize` | `/mt5initialize_py` |30| `login` | `/mt5login_py` |31| `shutdown` | `/mt5shutdown_py` |32| `version` | `/mt5version_py` |33| `last_error` | `/mt5lasterror_py` |34| `account_info` | `/mt5accountinfo_py` |35| `terminal_info` | `/mt5terminalinfo_py` |36| `symbols_total` | `/mt5symbolstotal_py` |37| `symbols_get` | `/mt5symbolsget_py` |38| `symbol_info` | `/mt5symbolinfo_py` |39| `symbol_info_tick` | `/mt5symbolinfotick_py` |40| `symbol_select` | `/mt5symbolselect_py` |41| `market_book_add` | `/mt5marketbookadd_py` |42| `market_book_get` | `/mt5marketbookget_py` |43| `market_book_release` | `/mt5marketbookrelease_py` |44| `copy_rates_from` | `/mt5copyratesfrom_py` |45| `copy_rates_from_pos` | `/mt5copyratesfrompos_py` |46| `copy_rates_range` | `/mt5copyratesrange_py` |47| `copy_ticks_from` | `/mt5copyticksfrom_py` |48| `copy_ticks_range` | `/mt5copyticksrange_py` |49| `orders_total` | `/mt5orderstotal_py` |50| `orders_get` | `/mt5ordersget_py` |51| `order_calc_margin` | `/mt5ordercalcmargin_py` |52| `order_calc_profit` | `/mt5ordercalcprofit_py` |53| `order_check` | `/mt5ordercheck_py` |54| `order_send` | `/mt5ordersend_py` |55| `positions_total` | `/mt5positionstotal_py` |56| `positions_get` | `/mt5positionsget_py` |57| `history_orders_total` | `/mt5historyorderstotal_py` |58| `history_orders_get` | `/mt5historyordersget_py` |59| `history_deals_total` | `/mt5historydealstotal_py` |60| `history_deals_get` | `/mt5historydealsget_py` |6162## Function Categories6364Use these categories to narrow down the user's query:6566- **Connection**: `initialize`, `login`, `shutdown`67- **Information**: `version`, `last_error`, `account_info`, `terminal_info`68- **Symbols**: `symbols_total`, `symbols_get`, `symbol_info`, `symbol_info_tick`, `symbol_select`69- **Market Depth**: `market_book_add`, `market_book_get`, `market_book_release`70- **Market Data**: `copy_rates_from`, `copy_rates_from_pos`, `copy_rates_range`, `copy_ticks_from`, `copy_ticks_range`71- **Orders**: `orders_total`, `orders_get`, `order_calc_margin`, `order_calc_profit`, `order_check`, `order_send`72- **Positions**: `positions_total`, `positions_get`73- **History**: `history_orders_total`, `history_orders_get`, `history_deals_total`, `history_deals_get`7475## Fetching Documentation7677For each relevant function, retrieve its documentation using whichever method the agent supports:7879- Native fetch tools (preferred).80- Browser automation tools.81- Shell fallback, for example:8283```bash84curl -fsSL "https://www.mql5.com/en/docs/python_metatrader5<url_path>"85```8687Extraction target for each page:8889- Function signature with all parameters.90- Parameter descriptions and types.91- Return value description.92- Notes/remarks.93- Full code example.9495When the query spans multiple functions, fetch pages in parallel when the agent/tooling supports it.9697## Response Format9899Present the results as:1001011. **Function**: `MetaTrader5.function_name()`1022. **Description**: What the function does1033. **Signature**: Full call signature with parameters1044. **Parameters**: Table or list of parameter names, types, and descriptions1055. **Returns**: Return type and description1066. **Example**: Code example from the documentation1077. **Source**: Link to the official documentation page