MetaTrader 5 Python User Group - how to use Python in Metatrader - page 6

 
Maxim Dmitrievsky:

i.e. it is possible to convert structure array to byte array to pass to socket? then it is strange why standard structToChar does not do it.

In uchar[] for sockets, uint[] for resources, double[] for global variables and frames, etc.

 

The MetaTrader5 package is already available in 32/64 libraries for Python 3.7 and is installed in one line.

pip install MetaTrader5
 
fxsaber:

In uchar[] for sockets, uint[] for resources, double[] for global variables and frames, etc.

well I see, I can't think of an example of what to pass... mqlrates can

 
Renat Fatkhullin:

The MetaTrader5 package is already available in 32/64 libraries for Python 3.7 and is put in one line.

Will the help be updated on the arguments of the fths? sometimes you forget what and where


 
Maxim Dmitrievsky:

Will there be an update on the fyi arguments? Sometimes you forget what and where.


Yes, this is the first hastily laid out.

The description of working from R/Python with MetaTrader 5 will be included in MQL5 documentation.

 

Checked the test script for Python from the 1st page, as far as I understand if the terminal is started with the /portable switch then nothing will work, it gives an error:

Traceback (most recent call last):

File "D:/py/mt5.py", line 5, in <module>

MT5WaitForTerminal()

RuntimeError: No IPC connection

if you run MT5 without/portable switch, the test script works without any problems

it is not convenient to run MT5 without /portable on my laptop - SSD is the first drive, it is a modest 80 GB, I install everything on the 2nd drive

I would like it to work with /portable key

 

I haven't worked with Pyton at all before.

So, on the download pagehttps://www.python.org/downloads/windows/ I select Download Windows x86-64 executable installer

Pyton Download Windows x86-64 executable installer


Click on the downloaded file ...

Run setup Python



Remember to check the PATH box in the installation window and install itself - Install Now

Add Python 3.7 to PATH



Deliver the matplotlib package for chart support

pip install matplotlib

Turns out, this command had to be entered in the Windows Command Window (right click on the Start button):

pip install matplotlib


The same way is done.

Run the installation package MetaTrader5

pip install MetaTrader5


Now we need to create file "metatrader5-test.py":

Starts the window


and menu File -> New File


The most exciting part is

Run the test script

python metatrader5-test.py

I still don't understand where and how to put this command. Made a workaround - in the open file "metatrader5-test.py" menu Run -> Run Module and the test script ran successfully.

Python Releases for Windows
Python Releases for Windows
  • www.python.org
The official home of the Python Programming Language
 
no need to prescribe anywhere, just click on the file and the script will run
 
Vladimir Karputov:

I still don't understand where and how to write this command. I did a workaround - in the open file "metatrader5-test.py" menu Run -> Run Module and the test script ran successfully.

Run Python scripts from the Windows command line, it will call a Python interpreter which will execute the script

You are running from an IDLE shell , python itself has no compiler - you can write scripts in notepad but save them with the extension .py

or install an IDE for python, Spyder all put first to rummage, then PyCharm or I'm a laptop Wing IDE installed - it does not require resources of your PC

 
Igor Makanu:

run python scripts from the windows command line, the python interpreter will be called to execute the script.

You are running from an IDLE shell , Python itself has no compiler - you can write scripts in notepad, but save them with a .py extension

or install an IDE for python, Spyder all put first to rummage, then PyCharm or I have a laptop Wing IDE - it does not demand the resources of your PC

Through the command linepython metatrader5-test.py does not work. Butpip install MetaTrader5 via command line worked.

( The file itself is saved by default to C:\Users\barab\AppData\Local\Programs\Python\Python37\ )
Reason: