Problem with the "MetaTrader5 (5.0.35 of 28.07.21) library. After installing and trying to import it, I get the following error
(PressPurtEnv) C:\Users\User>python
Python 3.9.6 (default, Jul 302021, 11:42:22) [MSC v.191664 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license"for more information.
>>> import MetaTrader5 as mt5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\User\AppData\Local\R-MINI~1\envs\PressPurtEnv\lib\site-packages\MetaTrader5\__init__.py", line 257, in <module>
from ._core import *
ModuleNotFoundError: No module named 'MetaTrader5._core'
>>> exit()
Returning to 5.0.33 works.
(PressPurtEnv) C:\Users\User>python
Python 3.9.6 (default, Jul 302021, 11:42:22) [MSC v.191664 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import MetaTrader5 as mt5
File "<stdin>", line 1
import MetaTrader5 as mt5
IndentationError: unexpected indent
>>> import MetaTrader5 as mt5
>>> mt5.initialize()
True
>>> print(mt5.version())
(500, 3003, '22 Jul 2021')
>>> print(mt5.terminal_info())
TerminalInfo(community_account=True, community_connection=True, connected=True, dlls_allowed=True, trade_allowed=True,
tradeapi_disabled=False, email_enabled=False, ftp_enabled=False, notifications_enabled=False, mqid=False, build=3003,
maxbars=25000, codepage=1251, ping_last=51530, community_balance=1.1, retransmission=0.0, company='MetaQuotes Software Corp.',
name='MetaTrader 5', language='Russian',path='C:\\Program Files\\MetaTrader 5',
data_path='C:\\Users\\User\\AppData\\Roaming\\MetaQuotes\\Terminal\\D0E8209F77C8CF37AD8BF550E51FF075',
commondata_path='C:\\Users\\User\\AppData\\Roaming\\MetaQuotes\\Terminal\\Common')
>>> mt5.shutdown()
True
>>> exit()
Python only sees the terminal in this implementation. It sends a request to it and gets an answer. It does not see the MKL program and cannot communicate with it. To interact with the MKL program, we must use additional features. I cannot say anything about interaction with the tester, I have not used it. But it is very likely that it is not possible.
Latest beta of terminal 3007 (at least for me). Not the point, it's not important for the question.
Trying to update.
(r-reticulate) C:\Users\User>pip install --upgrade MetaTrader5
Requirement already satisfied: MetaTrader5 in c:\users\user\appdata\local\r-miniconda\envs\r-reticulate\lib\site-packages (5.0.34)
Collecting MetaTrader5
Using cached MetaTrader5-5.0.35-cp38-cp38-win_amd64.whl (124 kB)
Requirement already satisfied: numpy>=1.7in c:\users\user\appdata\local\r-miniconda\envs\r-reticulate\lib\site-packages
(from MetaTrader5) (1.19.5)
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory:
'c:\\users\\user\\appdata\\local\\r-miniconda\\envs\\r-reticulate\\lib\\site-packages\\numpy-1.19.5.dist-info\\METADATA'
The latest beta of terminal 3007 (at least for me). Not the point, it's irrelevant to the question.
Trying to update
Can you tell me what this means?
According to your log - there is no such file or directory
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'c:\\users\\user\\appdata\\local\\r-miniconda\\envs\\r-reticulate\\lib\\site-packages\\numpy-1.19.5.dist-info\\METADATA'
How do I send data from mt5 to a running python script and receive a response?
I guess I have to use stdin and stdout, and specify the process to pass it to.
Does anyone have any code where this is implemented?
p.s. This: https://www.mql5.com/ru/docs/integration/python_metatrader5 has read, and used, but it's not suitable for this task. The data needs to be transferred from the strategy tester as well.
Problem with the "MetaTrader5 (5.0.35 of 28.07.21) library. After installing and trying to import it, I get the following error
Returning to 5.0.33 works.
Does anybody have this error confirmed?
Checked with Python versions 3.7/3.8/3.9
How do I send data from mt5 to a running python script and receive a response?
I guess I have to use stdin and stdout, and specify the process to pass it to.
Does anyone have any code where this is implemented?
p.s. This: https://www.mql5.com/ru/docs/integration/python_metatrader5 has read, and used, but it's not suitable for this task. The data needs to be passed from the strategy tester as well.
Python only sees the terminal in this implementation. It sends a request to it and gets an answer. It does not see the MKL program and cannot communicate with it. To interact with the MKL program, we must use additional features. I cannot say anything about interaction with the tester, I have not used it. But it is very likely that it is not possible.
Good luck
import os import MetaTrader5 as mt5 print (mt5.__version__) print (dir(mt5)) path_module=os.getcwd() print ("Start path os.getcwd():",path_module) ddir=path_module.split("\\") print (ddir) mt5.initialize() print(mt5.version()) print(mt5.terminal_info()) #---------------------------- dir = os.path.dirname(__file__) print ("Path os.path.dirname(__file__):",dir) abs_path = os.path.join(dir) print ("abs_path:",abs_path) ##variable = open(abs_path) #print (variable) #=============== #help("modules") print ('end')It does not see the MCL programme and cannot communicate with it. To communicate with the MCL program, you have to use additional features.
Anamed channel is fine by me, but some people do it on a socket. it's a matter of habit...
Problem with the "MetaTrader5 (5.0.35 of 28.07.21) library. After installing and trying to import it, I get the following error
Returning to 5.0.33 works.
Does anybody have this error confirmed?
Checked with Python versions 3.7/3.8/3.9
Upgraded to 5.0.35.
No errors.
Upgraded to 5.0.35.
No errors.
Latest beta of terminal 3007 (at least for me). Not the point, it's not important for the question.
Trying to update.
Can you tell me what this means?
The latest beta of terminal 3007 (at least for me). Not the point, it's irrelevant to the question.
Trying to update
Can you tell me what this means?
According to your log - there is no such file or directory
According to your log - there is no such file or directory
i.e. no numpy==1.19.5?
i.e. no numpy==1.9.5?
There doesn't seem to be a folder
"c:\users\\\user\\appdata\\local\r-miniconda\\\envs\\r-reticulate\\\lib\site-packages\numpy-1.19.5.dist-info\\\METADATA'