MetaTrader 5 Python User Group - how to use Python in Metatrader - page 20
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
At the very least, there should be detailed documentation that takes all cases into account. Universum is not that big - only 3 branches of operating systems - Win/Linux/MacOS.
Installed Microsoft build tools from https://visualstudio.microsoft.com/ru/downloads/?rr=https%3A%2F%2Fwww.google.com%2F. The package is now installed in Python 3.8. This problem is SOLVED.
C:\Users\labor>pip install MetaTrader5
Collecting MetaTrader5
Using cached https://files.pythonhosted.org/packages/3c/c8/713f1b8283cbbdef30dc9cf50a5d767f9b4a194eb4f886a8e50074b696a1/MetaTrader5-5.0.6.tar.gz
Installing collected packages: MetaTrader5
Running setup.py install for MetaTrader5 ... done
Successfully installed MetaTrader5-5.0.6
BUT! RuntimeError: IPC call failed:
C:\Users\labor>C:\Users\labor\Anaconda3\envs\metatrader5\python.exe C:/Users/labor/Downloads/MetaTrader5-Python/metatrader5-test.py
[2, 'Exness-MT5Real', '0000000'] # code is zeroed in the printout
[500, 2174, '11 Oct 2019']
Traceback (most recent call last):
File "C:/Users/labor/Downloads/MetaTrader5-Python/metatrader5-test.py", line 10, in <module>
ticks1 = MT5CopyTicksFrom("EURAUD", datetime(2019,1,28,13), 10000, MT5_COPY_TICKS_ALL)
RuntimeError: IPC call failed
The same error appears when there is no such symbol on the account in mt5. For example, EURPLN is not in the terminal
Terminal works as it should.
Please connect to MetaQuotes-Demo server, select Help -> Check Desktop Updates -> Latest Beta Build, wait for update. The build should be older than or equal to 2174. Try to run your script on this server and report the result.
PS. Also, make sure you have an account opened in the terminal, MT5TerminalInfo() returns reasonable values and MT5WaitForTerminal() returns True.
The same error occurs when there is no such symbol on the account in mt5. For example, EURPLN is not in the terminal
Please connect to MetaQuotes-Demo server, select Help -> Check Desktop Updates -> Latest Beta Build, wait for update. The build should be older than or equal to 2174. Try to run your script on this server and report the result.
PS. Also, make sure you have an account opened in the terminal, MT5TerminalInfo() returns reasonable values and MT5WaitForTerminal() returns True.
The account is open, the terminal works, and the package returns my password etc from it. ([2, 'Exness-MT5Real', '0000000'] , note: the password is locked), but an error occurs at the data extraction stage.
Same shit in Anaconda Python (took down Python 3.8 and installed a fresh Anaconda distribution that uses one of the versions of Python 3.7 and piped your MetaTrader5 into it):
File "C:\Users\labor\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/labor/.spyder-py3/temp.py", line 17, in <module>
eurusd_rates = MT5CopyRatesFrom("EURUSD", MT5_TIMEFRAME_M1, datetime(2019,4,5,15), 1000)
RuntimeError: IPC call failed
As you can see, it stumbles onMT5CopyRatesFrom during some file operation.Released an updated version of MetaTrader 5.0.7 for Python.
You can update as follows:
Released an updated version of MetaTrader 5.0.7 for Python.
You can update it like this:
any changes?
any changes?
Change from true/false results to detailed numeric codes.
Improved modes of waiting for data availability from the terminal.Please connect to MetaQuotes-Demo server, select Help -> Check Desktop Updates -> Latest Beta Build, wait for update. The build should be older than or equal to 2174. Try to run your script on this server and report the result.
PS. Also, make sure you have an account opened in the terminal, MT5TerminalInfo() returns reasonable values and MT5WaitForTerminal() returns True.
My terminal has build 2190; the terminal has the same tool requested in the script. The script returns my broker name and trade code:[2, 'Exness-MT5Real', '*******'].
After package update error occurs on the same line of code, error message has changed: 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]
Traceback (most recent call last):
File "C:/Users/labor/Downloads/MetaTrader5-Python/mt5test2.py", line 17, in <module>
eurusd_rates = MT5CopyRatesFrom("EURUSD", MT5_TIMEFRAME_M1, datetime(2019,4,5,15), 1000)
RuntimeError: Terminal: Call failed
My terminal has build 2190; the terminal has the same instrument requested in the script. The script returns my broker name and trade code: [2, 'Exness-MT5Real', '*******'].
Upgrade to MetaTrader 5.0.7 python package and attach the results, please.
Upgrade to MetaTrader 5.0.7 python package and attach the results, please.
1) I use Anaconda Python 3.7.4 and work in a virtual base environment. By the way, what version of Python is MetaTrader 5.0.7 package for ?
2) I installed Python 3.8 again at your request, updated the pip and already at the installation stage of matplotlib I get this (see the whole PROTOCOL in the staple):
Microsoft Windows [Version 10.0.17134.1069]. Holy crap...
(c) Microsoft Corporation, 2018. All rights reserved.
C:\Users\labor>pip install matplotlib
Collecting matplotlib
Using cached https://files.pythonhosted.org/packages/12/d1/7b12cd79c791348cb0c78ce6e7d16bd72992f13c9f1e8e43d2725a6d8adf/matplotlib-3.1.1.tar.gz
Requirement already satisfied: cycler>=0.10 in c:\python38\lib\site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\python38\lib\site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\python38\lib\site-packages (from matplotlib) (2.4.2)
Requirement already satisfied: python-dateutil>=2.1 in c:\python38\lib\site-packages (from matplotlib) (2.8.0)
Requirement already satisfied: numpy>=1.11 in c:\python38\lib\site-packages (from matplotlib) (1.17.3)
Requirement already satisfied: six in c:\python38\lib\site-packages (from cycler>=0.10->matplotlib) (1.12.0)
Requirement already satisfied: setuptools in c:\python38\lib\site-packages (from kiwisolver>=1.0.1->matplotlib) (41.2.0)
Installing collected packages: matplotlib
Running setup.py install for matplotlib ... error
ERROR: Command errored out with exit status 1:
command: '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\pip-record-ly12rvmr\install-record.txt' --single-version-externally-managed --compile
............. continued in the file
3) Installed matplotlib using http://www.lfd.uci.edu/~gohlke/pythonlibs/, installed pytz and your package as standard. Got the same error: RuntimeError: Terminal: Call failed. See clip 2.