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

 

http://localhost

not added in the terminal settings. hmm.

 

I am also studying Python, but solely as part of mastering neural networks, machine learning and other fancy stuff and packages. I do not think it is possible to work with this super-brainer, it is 200 times slower than MQL5, I cited the results of some simple tests.

I still haven't understood, is it possible to connect Python modules and call functions from MQL5? Or is it just a Python->MQL5 connection?

 
Alexey Volchanskiy:

I am also studying Python, but only as part of mastering neural networks, machine learning and other fancy stuff and packages. I do not think it is possible to work with this super-brainer, it is 200 times slower than MQL5, I cited the results of some simple tests.

I still haven't understood, is it possible to connect Python modules and call functions from MQL5? Or just Python->MQL5?

I don't agree about the super brake, try to change the libraries that are written in C / Cpp, the speed increases many times, and for neural networks, pay attention to TensorFlow, it has an API for Python.

I haven't worked closely with TensorFlow myself, only tests, but the information on the Internet suggests a positive result

 
Konstantin:

I do not agree about the super brake, try to change the libraries to those written in C/Cpp, the idea is that in many tasks the speed increases many times, and regarding neural networks, pay attention to TensorFlow, there is an API for Python

I did not use TensorFlow myself, only tests, but the information on the Internet says about the positive result.

There was a simple test without libraries, just calculating PI number in a primitive loop. Alas, I could not find my recent branch, here is an old one, without Python.

And I found my Python code

import time

start_time = time.time()

x, pi, sum1 = 0.0, 0.0, 0.0
NUM_STEPS = 10000000  
step1 = 1.0 / NUM_STEPS
i = 0
while i < NUM_STEPS:
    x = (i + .5) * step1
    sum1 = sum1 + 4.0 / (1. + x * x)
    i += 1

pi = sum1 * step1
msvcr = time.time() - start_time

print(f"--- {msvcr} seconds ---", pi)
 
Alexey Volchanskiy:

There was a simple test without libraries, just calculating PI number in a primitive loop. Alas, I could not find my recent branch, here is an old one, without Python.

And I found my code in Python.

Bare Python will of course be inferior in speed, just the same mathematical, statistical and other calculations are in the C / Cpp library for Python and there Python is not bad

 
Alexey Volchanskiy:

There was a simple test without libraries, just calculating PI number in a primitive loop. Alas, I could not find my recent branch, here is an old one, without Python.

And I found my Python code

Python's strength is in libraries, not in loops and other operators.











 
Dmitriy Skub:

Python's strength is in libraries, not in loops and other operators.











Yeah, I figured that out after the test, though I guessed it, it's the interpreter. But I thought it was somehow caching machine commands from the interpreted code. But judging by the difference in hundreds of times, there's no such thing.

All in all, this is my humble opinion, I'm not thrilled. I don't like the language itself either, but that's personal.

Fortunately, many frameworks provide an interface to C++, C#. And DLL's in these languages connect well to MQL5.

In general with this ML I feel like in the first class ))

 
Alexey Volchanskiy:

Yeah, I figured that out after the test, though I guessed it anyway, it's the interpreter. But I thought it was somehow caching machine commands from the interpreted code. But judging by the difference in hundreds of times, there's no such thing.

All in all, this is my humble opinion, I'm not thrilled. I don't like the language itself either, but that's personal.

Fortunately, many frameworks provide an interface to C++, C#. And DLL's in these languages have excellent connectivity to MQL5.

In general with this ML I feel like in the first class)).

Python is a normal language for prototyping, screw the rest)) the most normal and elegant language is C++

 

I've been trying to get Metatrader5 for python on Mac OS for the second day now.
The pip install MetaTrader5 is not working.
I am getting an error

fatal error: 'sdkddkver.h' file not found

#include <sdkddkver.h>

^~~~~~~~~~~~~

1 error generated.

error: command 'cc' failed with exit status 1


Any advice on how to connect?






 
Hi, Sorry for my Russian, but I used google translator. I have done a lot of work and I already have results. I'm using Python 3 Packages: selenium. What I have achieved so far is to open mt4 web, enter username/password, load all pairs and place orders. I'm having trouble getting the SL movement done. If you are interested in going down this path, we would be happy to cooperate. Greetings from Chile