Discussion of article "Universal Expert Advisor: Integration with Standard MetaTrader Modules of Signals (Part 7)"

 

New article Universal Expert Advisor: Integration with Standard MetaTrader Modules of Signals (Part 7) has been published:

This part of the article describes the possibilities of the CStrategy engine integration with the signal modules included into the standard library in MetaTrader. The article describes how to work with signals, as well as how to create custom strategies on their basis.

The below diagram shows the general scheme of vertical inheritance of classes used in the process of automatic generation of strategies:

 

Fig. 1. Inheritance of standard classes of the strategy generator

The figure only shows basic and some derived classes. The scheme does not feature all indicators inherited from CIndicators. Separate trailing, money management and signal modules are not included into the scheme. Instead, only the basic relationships are outlined. One of the featured groups is of interest to us: the signal classes CExpertSignal and its child classes. In Figure 1, the group is highlighted by a green dotted line.

Author: Vasiliy Sokolov

 

Vasily, interesting as always. First of all, from the programming point of view... although what else can you expect on an MQL forum....

A small remark :-)))

Inheritance is usually drawn from bottom to top. Approximately like this:



 
I wrote something similar in mql4 in one file and without using third-party libraries, so that to generate a signal user can build a free tree of relationships between 70 elements for ten any custom indicators, to collect the result of the built conditions from such a garden is a lot of fun, but it turned out something really universal.
 
Dennis Kirichenko:

Vasily, interesting as always. First of all, from the programming point of view... although what else can you expect on an MQL forum....

A small remark :-)))

Inheritance is usually drawn from bottom to top. That's about right:

I didn't know. I guess I'm left-handed, so I got it the other way round:)
 
Aleksey Semenov:
I wrote something similar in mql4 with one file and without using third-party libraries, so that to generate a signal user can build a free tree of relationships between 70 elements for ten any custom indicators, to collect the result of the built conditions from such a garden is a lot of fun, but it turned out something really universal
Can you see the prototype?
 
Aleksey Semenov:
I wrote something similar in mql4 with one file and without using third-party libraries, so that to generate a signal user can build a free tree of relationships between 70 elements for ten any custom indicators, to collect the result of the built conditions from such a garden is a lot of fun, but it turned out something really universal.
Yes, I am inclined to the fact that a universal strategy generator should be written on the basis of a tree, but the task is quite difficult.
 
Question for the public: does anyone use the MetaTrader signal system at all? And who uses signal classes in their Expert Advisor programming?
 
Vasiliy Sokolov:
Question for the public: does anyone use the MetaTrader signal system at all? And who uses signal classes in their Expert Advisors programming?

Я. I always do this:

  • write an indicator
  • I make a signal module on the basis of the indicator
  • When building an Expert Advisor, I connect the necessary module of signals.
At first it may seem that the way is not close, but in fact it is very convenient to change, modify indicator signals or invent new signals.

 
Karputov Vladimir:

Я. I always do:

  • write an indicator
  • I make a signal module based on the indicator
  • When building an Expert Advisor, I connect the necessary module of signals.
At first it may seem that the way is not close, but in fact it is very convenient to change, modify indicator signals or invent new signals.

A really thorough approach. Yes, it has its advantages.

In general, many developers have already written their own signal modules. Why not create a centralised base of such modules? Anyone can share his module and post it in the database. Grail of course not to water, but the benefits will be obvious for all, we will not have to reinvent the wheel.

 

When initialising the indicator signals:

//+------------------------------------------------------------------+
//| Initialisation of the CSignalMacd signal module |
//+------------------------------------------------------------------+
COnSignal_RSI_AC::COnSignal_RSI_AC(void)
{
   MqlSignalParams params;
   params.every_tick = false;
   params.magic = 32910;
   params.point = 10.0;
   params.symbol = Symbol();
   params.period = Period();
   params.usage_pattern = 2;
   params.signal_type = SIGNAL_AC;
   CSignalAC* ac = m_adapter_ac.CreateSignal(params);
   params.usage_pattern = 1;
   params.magic = 32911;
   params.signal_type = SIGNAL_RSI;
   CSignalRSI* rsi = m_adapter_rsi.CreateSignal(params);
   rsi.PeriodRSI(RSI_Period);
}
one signal module (adapter) is transmitted one Magik (32910), the second one is transmitted the second one (32911). I.e. one Magik will be used to open positions and another one to close them? Or do I understand something wrong?
 
Гога:

When initialising the indicator signals:

one signal module (adapter) is transmitted one Magik (32910), the second one is transmitted the second one (32911). I.e. one Magik will be used to open positions and another one to close them? Or am I misunderstanding something?
In this case, the Magiks are CExpert rudemembers, from which the signal itself is inherited. The signal does not need it, at least in CStrategy, because it does not place pending orders. However, some majic is specified just in case.