Making a Python trading system for MT.

 
The idea of writing a trading system in Python came up, and since it did, why not make it available to the public. Perhaps someone besides me would be interested in it as well.
But why Python?
- It's a complicated question with many aspects. I'll try to answer it.
Historically, I have four terminals installed on my computer. Some of them with full-fledged API, some with their own non-standard languages, some with both.
The first, in distant 2008, was the terminal with API - it was used for creating first systems, which eventually reached the languages C++/C#. When further terminals were added (with or without languages), the system was not redesigned, only a new interface between the terminal and the system was developed. Thus, the system is unified, and to work with another terminal, just connect the required interface. In the simplest case, it takes no more than one day. And there is no desire to redesign the system for a particular terminal.
The terminal is only a provider of data and an executor of requests. That's all - nothing more is required of it.
This is the ideology of the system.
But this is only one aspect. The others are in the next posts. I don't promise to write often.
 
In Python, who wants to? I have plans to port some things to Java in about 3 months. I'm thinking about it. And I haven't even seen any broker API in python at all. Although... maybe there are some, of course.
 
Yes, but why Python?
Actually, Python interested me because it has a lot of libraries (modules), including those for Machine Learning (machine learning or MO), which is what I've been doing for the last year. However, I haven't worked with Python - I haven't written a line yet). Well, I've tried something abstract, but without specific goals.
However, in order to apply Python specifically to trading systems it is necessary, for a start, to debug its interaction both with TS and terminal.
I considercalling Pythonfunctions from MQL via DLL to be wrong - to call Python function this way, I must run an interpreter and use it to call the function - and this is a very long process for each call.
I have a different concept: TC is a full-fledged EXE application that stores all previous data and necessary history. So we only call function from already running application - time of call is minimal.
Some people say - write - that Python is very slow. This is not true. For most systems (even intraday) the performance of Python is more than enough, and we will see that later. As for HFT, we cannot compete with them at any speed - it's other money). And other spreads).
 
Viktar Dzemikhau:
In Python, I don't know who wants to. I have plans to port some things to Java in about 3 months. I am thinking about it. And in python I haven't even seen API of any brokers at all. Although... maybe there are some, of course.

Hang on, let's do the API as well. In this thread. Not all at once). If there's interest, on the forum side.

IMHO, Java is not an option. I may be wrong.

 
Konstantin Nikitin:
As an alternative, you may write C++ using QT. One of the advantages is that you can immediately write for cross-platform compilation.

I agree. But the intention in this thread is Python and using its libraries (modules). And we'll end up with a cross-platform (crossterminal) API. For any programming language.

But, in general, for most of TC Python is more than enough. And the interface to write between the TC and any terminal is, well, 1 day at most.

But, not at once, depending on free time. I don't promise anything on a regular basis.

 
The Python interpreter is run once, then you can use it in an EA or indicator. Everything is already done and is available on the forum. There is a thread about machine learning. Use https://github.com/RandomKori/Py36MT5
 
Grigoriy Chaunin:
The Python interpreter is run once and then you can use it in your Expert Advisor or indicator. Everything has already been done and is available on the forum. There is a thread about machine learning. Use https://github.com/RandomKori/Py36MT5

Yes, thank you. But the idea is different. You need a full-fledged application, an EXE, to implement it. But something may come in handy. It's a pity the source code of DLL is absent, but it's not crucial.

 
The sources are all laid out there.
 
Grigoriy Chaunin:
All the sources are laid out there.

Yes, indeed, the whole DLL project is in VS. Underexplored.

And somehow missed that link in the MoD thread.

But, normal heroes always go the rounds (c). And we'll go our own way). This thread has other tasks.

 

Let's start by creating a Python application that will exchange data with the terminal - receive data from the terminal and output it to the output window, as well as send data to the terminal from the SendData window. It will be necessary for testing of TC interaction with the terminal.

So far, the application performs no functions.

Here is the window.

Python code in attachment.

Files:
PyTS.txt  2 kb
 
Yuriy Asaulenko:

Let's start by creating a Python application that will exchange data with the terminal - receive data from the terminal and output it to the output window, as well as send data to the terminal from the SendData window. It will be necessary for testing of TC interaction with the terminal.

So far, the application performs no functions.

Here is the window.

Python code in attachment.

Where are the comments in code? Do you think everyone here understands Python and your ideas, comments will be redundant?

What's with all the crapshooting""" Окно вÐомааав """ ?

What library import tkinter, where the description of its functions (methods)?