Buy stop Sell stop Grid advisor as a class

 

I'm opening a project

Draft Buy stop Sell stop Grid advisor as a class

To test a strategy for working with pending stop orders.

The essence of trade: at start we put two stop pending orders (Buy stop and Sell stop). If one triggered, then delete the second (we will just modify it later, but for now, simply delete it) and again two stop pending orders.

The meaning: a set of positions in accordance with the trend.

Screenshot (result when there is a trend and several pending orders have triggered):

Buy stop Sell stop Grid

(a little later ...).


How to access the full code: ONLY through connection to the project, while the pieces will of course be in discussion in this thread. The EA itself will be in the form of a class (*.mqh).


Added:

When the EA is running, data is written to an array in OnTradeTransaction. The format of recording is as follows: if we have a Buy position, we record '+1'; if we have a Sell position, we record '-1'.

Let's check the idea of pyramiding (in case a position was opened in the direction of the previous one)

 
Vladimir Karputov:

I am opening a project to test a strategy for working with pending stop orders.

The essence of trade: at start we put two stop pending orders (Buy stop and Sell stop). If one triggered, then delete the second (we will simply modify it later, but for now, simply delete it) and again two stop pending orders.

The meaning: a set of positions by trend.

Picture:

(a little later ...).


How to access the full code: ONLY through connection to the project, while the pieces will of course be in discussion in this thread. The Expert Advisor itself will be in the form of a class (*.mqh).


I am currently doing something similar to order, only more complicated

 

I will follow the project with interest...

 
Vasily Bykov:

I will follow the project with interest...


Please clarify, do you want to be connected to the project(Projects - MetaEditor) ?

Проекты - Справка по MetaEditor
Проекты - Справка по MetaEditor
  • www.metatrader5.com
MetaEditor позволяет программистам вести совместную разработку приложений на MQL4/MQL5 удаленно. Специально для этих целей в нем предусмотрены...
 

Hi!


Such robots are known and available. And what is the point of your project?
 
Alexander Ivanov:

Hi!


Such Expert Advisors are known to exist. And what is the point of your project?

The main objectives are described above:

  • is to create an EA as a separate class
  • development of projects(Projects - MetaEditor)
  • testing a trading strategy on stop pending orders

Проекты - Справка по MetaEditor
Проекты - Справка по MetaEditor
  • www.metatrader5.com
MetaEditor позволяет программистам вести совместную разработку приложений на MQL4/MQL5 удаленно. Специально для этих целей в нем предусмотрены...
 

I find the topic interesting. First of all, the condition "as a class".

My "purely as a class" didn't work. The system architecture includes the Main Template, which contains standard functions OnInit(), OnTick(), etc. Also, the object of CExpert class is declared in it - it has functions - class members, which are handlers of all these events. In the Main template - the member functions are called from standard functions.

So, we already have "not purely in the form of a class", because there are standard functions, from which the event handlers of the EA class are called.

And in this architecture, if we want to replace this very EA class, we will have to rewrite this entire template file. The EA as a class" should look like this: we declare an EA class (all its description is in the include files), include a template - and that's it.

In other words, it turns out that in the template, there should be standard functions, a hub object that connects the EA to these standard functions, and then the main file can be reduced to "correct structure" - declaring an EA object and connecting the template. In this case, in the main file, we declare an EA object, connect the main template, the hub object registers an object and connects its handler functions in the main template to the standard event functions.

It is even possible to implement a lot of TC in one EA - for this, several EA objects are declared and the Hub class connects them all to main functions, and they work independently of each other (of course, when connecting, one must check the difference in magicians, and the EAs themselves must select positions of their magicians).


About "connect me to the project" - I'm ready to connect in Read Only mode - I'm unlikely to write anything, but I can look, suggest something, point out errors.

 
George Merts:

***

And further, in this architecture, if we want to replace this very class-advisor, we will have to rewrite this entire template file. The "EA as a class" should look like this: we declare an EA class (all its description - in include files), connect the template - and that's it.

***

... connect the template and pass the input parameters to the Expert Advisor class


George Merts:

***

About "connect me to the project" - ready to connect in Read Only mode - it is unlikely I will write something, but to look, to offer something, to point out errors - I can.


Done, connected.

 
Vladimir Karputov:

... connect the template and pass the input parameters to the EA class



Done, plugged in.

О ! I have it. I have the files. When I have time, I'll see what's there.

 
Ibragim Dzhanaev:

Who can't program, can't participate?


Anyone can participate, but only those who want to join the project(Projects - MetaEditor) will have access to the FULL code. There will be a discussion of the project, so the opinion of anyone (programmer or user) will be valuable.

Проекты - Справка по MetaEditor
Проекты - Справка по MetaEditor
  • www.metatrader5.com
MetaEditor позволяет программистам вести совместную разработку приложений на MQL4/MQL5 удаленно. Специально для этих целей в нем предусмотрены...
 
Ibragim Dzhanaev:

I don't know how to program, but I built your idea for 4.



There is only mql5 here. The old terminal does not quote.