Discussion of article "Continuous Walk-Forward Optimization (Part 1): Working with Optimization Reports" - page 2

 
The article is interesting. Everything is clearly described. I am just learning C# programming. Is it possible to write a robot in C#? And how to do it, so that it could trade in termenal? Thank you very much!
 
Irina Dymura:
The article is interesting. Everything is clearly described. I am just learning C# programming. Is it possible to write a robot in C#? And how to do it so that it could trade in termenal? Thank you very much!

Anything is possible, but it is much better to write it in MQL5. However, either for educational purposes or for other needs, you can try. There are several options, the simplest and most optimal of them is to write all the logic in C# in the project dll (dynamic library). Then declare a public class with a number of public static methods in it (they will be exported as C functions in MQL5). Approximately, the class should contain a method that initialises the robot, destroys the robot and is called on each tick (similar to OnInit, OnDeinit, OnTick). Then the robot is created in MQL5 where the mentioned static functions from the created dll are exported and after compilation the following docking will be obtained:
1. MQL5 calls the initialising method from the dll in OnInit. The dll initialises the robot class into a static variable.

2. MQL5 OnTick calls the OnTick method from dll, and in response receives a sign to sell / buy / do nothing. If it is necessary to enter a deal, we enter using the code written in MQL5.

3. MQL5 OnDeinit deletes the robot, we call the OnDeinit method from the dll and do something. In C# you don't need to delete classes, Garbige Collector does it, everything with memory is practically automated there.

I.e. calculations are on the C# side, and trading is on the MQL5 side.

There are also some similar APIs for the terminal, where the code from C# directly interacts with MQL5 through pipes or other connections. I even came across such a project on github, but in my opinion it is easier to write everything through a dll.

In the last series of articles about optimisation management, I showed how to use a dll to connect WPF GUI with C#. You can use the same method to transfer the robot to C#. Before my article they also wrote about the GUI, but only WinForms and MQL5, I have adopted part of this mechanism, I don't remember the link to that article, but it is also quite useful. I think I referred to it somewhere in this article.

Also, in the 3rd article of this series of articles, it is described how to export a number of static functions to MQL5 from dll.

Управление оптимизацией (Часть I): Создание графического интерфейса
Управление оптимизацией (Часть I): Создание графического интерфейса
  • www.mql5.com
Вопрос альтернативного запуска терминала MetaTrader уже поднимался в статье Владимира Карпутова, а так же на сайте MetaTrader — существует страница, описывающая порядок работы и альтернативного способа запуска терминала. Оба перечисленных источника легли в основу данной статьи, однако ни в одном из них нет описания как создать удобный и...
 
Hello!
So before I can use this program, will I have to convert using Visual Studio?
 
Guilherme Mendonca:
Hello!
So before I can use this program, will I have to convert using Visual Studio?

Hello. This is the first article from 5 parts that are already published. At the 4rth part - there is full program. And yes, you have to compile some code it visual studio. If say about code that where ateched to the current article - so yes, it must be compiled in visual studio.

 
https://www.mql5.com/en/articles/7059