MetaTrader 5 Python用户组 - 如何在Metatrader中使用Python - 页 20

 
capissimo:

至少,应该有考虑到所有情况的详细文件。 Universum没有那么大--只有3个分支的操作系统--Win/Linux/MacOS。

https://visualstudio.microsoft.com/ru/downloads/?rr=https%3A%2F%2Fwww.google.com%2F,安装了微软的构建工具。 该软件包现在已经安装在Python 3.8中。这个问题已经解决了。

C:\Users\labor>pip install MetaTrader5

收集MetaTrader5

Using cached https://files.pythonhosted.org/packages/3c/c8/713f1b8283cbbdef30dc9cf50a5d767f9b4a194eb4f886a8e50074b696a1/MetaTrader5-5.0.6.tar.gz

安装收集的软件包:MetaTrader5

为MetaTrader5运行setup.py安装 ...完成

成功安装MetaTrader5-5.0.6


但是!RuntimeError: IPC调用失败。

C:\Users\labor>C:\Users\labor\Anaconda3\envs\metatrader5\python.exe C:/Users/labor/Downloads/MetaTrader5-Python/metatrader5-test.py

[2, 'Exness-MT5Real', '0000000'] # 代码在打印输出中被清零。

[500, 2174, '11 Oct 2019']

回溯(最近的一次调用)。

文件 "C:/Users/labor/Downloads/MetaTrader5-Python/metatrader5-test.py", 第10行, in <module>.

ticks1 = MT5CopyTicksFrom("EURAUD", datetime(2019,1,28,13), 10000, MT5_TICKS_ALL)

RuntimeError: IPC调用失败

当mt5的账户上没有这样的符号时,也会出现同样的错误。例如,EURPLN不在终端中


 
capissimo:
终端机正常工作。

请连接到MetaQuotes-Demo服务器,选择帮助->检查桌面更新->最新测试版,等待更新。 构建的时间应该是大于或等于2174年。试着在这个服务器上运行你的脚本并报告结果。


PS。另外,确保你在终端开了一个账户,MT5TerminalInfo()返回合理的值,MT5WaitForTerminal()返回真。

 
Maxim Dmitrievsky:

当mt5的账户上没有这样的符号时,也会出现同样的错误。例如,EURPLN不在终端中


从一开始就考虑到了这一点--修改了代码以适应我的资产,但没有用。
 
Almaz:

请连接到MetaQuotes-Demo服务器,选择帮助->检查桌面更新->最新测试版,等待更新。构建的时间应该是大于或等于2174年。试着在这个服务器上运行你的脚本并报告结果。


PS。另外,确保你在终端开了一个账户,MT5TerminalInfo()返回合理的值,MT5WaitForTerminal()返回真。

帐户是开放的,终端是工作的,软件包从里面返回我的密码等。([2, 'Exness-MT5Real', '0000000'] , 注意:密码被锁定),但在数据提取阶段出现了错误。

在Anaconda Python中也是如此(拿下Python 3.8并安装了一个新的Anaconda发行版,该发行版使用Python 3.7的其中一个版本,并将你的MetaTrader5移植到其中)。

文件 "C:\Users\labor\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py",第110行,in execfile

exec(compile(f.read(), filename, 'exec'), namespace)

文件 "C:/Users/labor/.spyder-py3/temp.py",第17行,在<module>中

eurusd_rates = MT5CopyRatesFrom("EURUSD", MT5_TIMEFRAME_M1, datetime(2019,4,5,15), 1000)

RuntimeError: IPC调用失败

正如你所看到的,它在一些文件操作中偶然发现了MT5CopyRatesFrom
 

发布了MetaTrader 5.0.7 Python的更新版本。

你可以按以下方式更新。

pip install --upgrade matplotlib
pip install --upgrade MetaTrader5
 
MetaQuotes Software Corp.:

发布了MetaTrader 5.0.7 Python的更新版本。

你可以这样更新它。

有什么变化吗?

 
Maxim Dmitrievsky:

有什么变化吗?

从真/假结果改为详细的数字代码。

改进了等待来自终端的数据可用性的模式。
 
Almaz:

请连接到MetaQuotes-Demo服务器,选择帮助->检查桌面更新->最新测试版,等待更新。构建的时间应该是大于或等于2174年。试着在这个服务器上运行你的脚本并报告结果。


PS。另外,确保你在终端开了一个账户,MT5TerminalInfo()返回合理的值,MT5WaitForTerminal()返回真。

我的终端有build 2190;终端有脚本中要求的相同工具。脚本返回我的经纪人名字和交易代码:[2, 'Exness-MT5Real', '*******']。

在同一行代码发生软件包更新错误后,错误信息已经改变:RuntimeError: Terminal: Call failed

(base) C:\Users\labor>python.exe C:/Users/labor/Downloads/MetaTrader5-Python/mt5test2.py

[2, 'Exness-MT5Real', '0000000']

[500, 2190, '18 Oct 2019]

回溯(最近的一次调用)。

文件 "C:/Users/labor/Downloads/MetaTrader5-Python/mt5test2.py", 第17行, <module>中

eurusd_rates = MT5CopyRatesFrom("EURUSD", MT5_TIMEFRAME_M1, datetime(2019,4,5,15), 1000)

RuntimeError: Terminal: Call failed

 
capissimo:

我的终端有build 2190;终端有脚本中要求的相同仪器。脚本返回我的经纪人名字和交易代码:[2, 'Exness-MT5Real', '*******']。

请升级到MetaTrader 5.0.7 python软件包并附上结果。

 
MetaQuotes Software Corp.:

请升级到MetaTrader 5.0.7 python软件包并附上结果。

1) 我使用Anaconda Python 3.7.4,在一个虚拟的基础环境中工作。顺便问一下,MetaTrader 5.0.7包是什么版本的Python?

2) 我按照你的要求重新安装了Python 3.8,更新了pip,在matplotlib的安装阶段,我得到了这个结果(见钉子里的整个PROTOCOL)。

微软视窗[版本10.0.17134.1069]。我的妈呀...

(c) 微软公司,2018年。保留所有权利。

C:\Users\labor>pip install matplotlib

收集matplotlib

Using cached https://files.pythonhosted.org/packages/12/d1/7b12cd79c791348cb0c78ce6e7d16bd72992f13c9f1e8e43d2725a6d8adf/matplotlib-3.1.1.tar.gz

已经满足要求:cycler>=0.10 in c:\python38\lib\site-packages(来自matplotlib)(0.10.0)

已经满足要求:kiwisolver>=1.0.1 in c:\python38\lib\site-packages(来自matplotlib)(1.1.0)。

已经满足要求:pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\python38\lib\site-packages (from matplotlib) (2.4.2)。

已经满足要求:c:\python38\lib\site-packages中的python-dateutil>=2.1(来自matplotlib)(2.8.0)。

已经满足要求:c:\python38\lib\site-packages中的numpy>=1.11(来自matplotlib)(1.17.3)。

已经满足的要求:c:\python38\lib\site-packages中的六个(来自cycler>=0.10->matplotlib)(1.12.0)。

已经满足要求:c:\python38\lib\site-packages中的setuptools(来自kiwisolver>=1.0.1->matplotlib)(41.2.0)。

安装收集的软件包:matplotlib

运行setup.py install for matplotlib ...错误

ERROR: 命令出错,退出状态1。

命令:'c:\python38\python.exe' -u -c'import sys, setuptools, tokenize; sys.argv[0] = '"''C:\Users\labor\AppData\Local\Temp\pip-install-unwrm6r5\matplotlib\setup.py''; __file_''''C:\Users\labor\AppData\Local\Temp\pip-install-unwrm6r5\matplotlib\setup.py'';f=getattr(tokenize, ''''open'', open)(__file__);code=f.read().replace(''''\r\n'', '''''\n'');f.close();exec(compile(code, __file__, ''exec'')' install --record 'C:\Users\labor\AppData\Local\Temp\p-record-ly12rvmr\install-record.txt' --single-version-externally-managed --compile

.............,在文件中继续介绍

3) 使用http://www.lfd.uci.edu/~gohlke/pythonlibs/安装了matplotlib,按标准安装了pytz和你的软件包。 得到同样的错误:RuntimeError: Terminal: Call failed.见片段2。

附加的文件:
6ww6n.zip  7 kb
report.zip  2 kb