I need clarification about the official, version-specific Python/NumPy representation contract of the MetaTrader5 Python package.
Caution: Brave browser AI reply...
Prompt
mt5 numpy python requirements
Response
To integrate **MetaTrader 5** with **Python**, you must use **Python 3.6 to 3.12** (specifically the **64-bit** version) and strictly manage the **NumPy** dependency.
**Python Version Requirements**
* **Supported Range**: The official `metatrader5` package supports **Python 3.6 through 3.12**.
* **Architecture**: You must use the **64-bit** version of Python; the 32-bit version is not supported.
* **Installation Command**:
```bash
pip install MetaTrader5
```
**NumPy Compatibility Constraints**
* **Critical Conflict**: The `MetaTrader5` package is compiled against **NumPy 1.x**. It is **incompatible** with **NumPy 2.x**.
* **Required Version**: You must install **NumPy 1.26.4** (or any version `< 2.0`) to prevent `ImportError` or runtime crashes.
* **Installation Command**:
```bash
pip install numpy<2.0
# Specifically recommended:
pip install numpy==1.26.4
```
**Additional Setup Notes**
* **MT5 Terminal**: The **MetaTrader 5 desktop terminal** must be installed and **running** on your system before initializing the connection in Python.
* **Common Libraries**: For data analysis, install **Pandas** and **Matplotlib** alongside NumPy:
```bash
pip install pandas matplotlib
```
* **Connection Initialization**: After installation, initialize the connection in your script using:
```python
import MetaTrader5 as mt5
if not mt5.initialize():
print("Error initializing MT5")
```
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I need clarification about the official, version-specific Python/NumPy representation contract of the MetaTrader5 Python package.
Could MetaQuotes please confirm whether this exact combination is officially supported?
MetaTrader5 Python package: 5.0.6231
Platform: Windows AMD64 (win_amd64)
CPython: 3.13.14 / cp313
NumPy: 2.5.3
Wheel: metatrader5-5.0.6231-cp313-cp313-win_amd64.whl
If this exact combination is not supported, please provide one exact currently supported MetaTrader5 / Windows / CPython / NumPy combination instead.
For a supported combination, I need the normative representation specification for the rates and ticks returned by the official MetaTrader5 Python API.
For rates, could you please confirm:
Exact container type, rank and shape, including empty, single-row and multiple-row results.
Complete field names and their order.
Exact dtype kind and bit/byte width of every field.
Integer signedness and byte order.
Field offsets, total itemsize, alignment, padding and applicable stride/contiguity guarantees.
Whether object-containing, nested, subarray or variable-size fields can occur.
Exact Python/NumPy scalar class returned when each field is indexed.
For ticks, could you please confirm:
Exact container and row representation.
Complete field names and order.
Exact dtype kind, width and signedness for every field.
Exact Python/NumPy scalar classes returned when fields are indexed.
Byte order, offsets, itemsize, alignment and padding where applicable.
Any officially supported alternative representations.
For time fields, could you please confirm the normative semantics of:
rate time
tick time
tick time_msc
Specifically: epoch, UTC semantics, units, precision, supported range, zero/missing/sentinel behavior, and the required consistency relationship between seconds and milliseconds.
I would also like to know whether missing, additional or reordered fields, different shapes, or different scalar representations can ever be returned for a supported version combination, and how such variants are distinguished.
I am specifically asking about the guaranteed Python binding representation, not example output or only the native MQL5 MqlRates structure.
If these details are already specified in official version-specific documentation or inspectable MetaQuotes binding source code, a link to the exact specification/source would be ideal.
No account investigation, terminal initialization or market-data collection is required for this question. I only need the documented Python binding contract.
Thank you.