Questions on MQL5 Wizard and standard library of trading classes - page 6

 
uncleVic:
Master and classes for him moved so far in the "maintenance mode". For the creation of the simplest multivariant classes are already adapted (not ready now, but later I will put here an example).

I made a multi-currency class based on the one generated by the wizard. But I had to correct the EXPERT class.

In the very beginning of it in INIT() method there is a check for working symbol and consequently no multicurrency. The check was removed and everything went well. Look at the time - the idea at least that?

if(symbol!=Symbol() || period!=Period()) 

на

 if(period!=Period())

Files:
Master01_ML.mq5  14 kb
 

Hello Moderator!

I have such a question:

MQL5 Wizard has 20 modules of signals that perform analysis for divergence, overbought, oversold, etc. Could you advise whether it is possible to borrow any such module of signals from the MQL5 Wizard to perform the analysis of the same, but from a custom indicator of your own design and what should be done for that? Will it require much rework (redesign) or is it enough to change something in the module (its copy) from the standard delivery?

Thanks in advance!

Переход на новые рельсы: пользовательские индикаторы в MQL5
Переход на новые рельсы: пользовательские индикаторы в MQL5
  • 2009.11.23
  • Андрей
  • www.mql5.com
Я не буду перечислять все новые возможности и особенности нового терминала и языка. Их действительно много, и некоторые новинки вполне достойны освещения в отдельной статье. Вы не увидите здесь кода, написанного по принципам объектно-ориентированного программирования — это слишком серьезная тема для того, чтобы просто быть упомянутой в контексте как дополнительная вкусность для кодописателей. В этой статье остановимся подробней на индикаторах, их строении, отображении, видах, а также особенностях их написания по сравнению с MQL4.
 

ForexMoneyMaker:

Do you know if it is possible to borrow any such module of signals from the MQL5 Wizard to perform the analysis of the same, but from a custom indicator of your own design, and what should be done for that? Will it require much rework (redesign), or it will be enough to change something in the module (its copy) from the standard delivery?

Good question! And here's why - it really is possible with minimal modifications of the standard modules to create a new module, just by inserting another indicator instead of one. I don't know when we will be able to write an article on this topic ourselves, so I suggest:

Who has knowledge and desire to write an article "How to create your own on the basis of the standard module of signals" - write me in the personal message.

 
Erm955:

I made a multi-currency class based on the one generated by the wizard. But I had to correct the EXPERT class.

In the very beginning of it in INIT() method there is a check for working symbol and consequently no multicurrency. The check was removed and everything went well. Look at the time - the idea at least that?

if(symbol!=Symbol() || period!=Period()) 

на

 if(period!=Period())

The idea is the same, but:

1. it's not good to change CExpert class. It's good to inherit from it by overriding the Init(...) method.

2) You don't have to modify the CExpert class. You have to write it:

...
   if(!ExtExpert_EG.Init(Symbol(),PERIOD_M10,Expert_EveryTick,Expert_MagicNumber))
     {
      //--- failed
      printf(__FUNCTION__+": error initializing expert");
      ExtExpert_EG.Deinit();
      return(-1);
     }
   ExtExpert_EG.Symbol("NZDUSD");
...

For now...

 
ForexMoneyMaker:

Hello Moderator!

I have such a question:

MQL5 Wizard has 20 modules of signals that perform analysis for divergence, overbought, oversold, etc. Can you advise whether it is possible to borrow any such module of signals from the MQL5 Wizard to perform the analysis of the same, but from a custom indicator of your own design and what should be done for that? Will it require much rework (redesign) or is it enough to change something in the module (its copy) from the standard delivery?

Thanks in advance!


Have a look at the English forum here
 
uncleVic:

The idea is the same, but:

1. it's not good to modify the CExpert class. It's good to inherit from it by overriding Init(...) method.

2. You don't need to modify the CExpert class. You have to write it:

So far...

You should redefine the Init() method and exclude the check for the working symbol from it. But p. 2 does not fit, since the Init() method, among other things, contains a check for the number of digits Digits and if the work symbol contains 5 digits, and the one being tested contains 3 digits, there will be an error with stops/profits. I inherited and overridden. Everything works now.

Of course, I'm not a great expert on OOP, but it turns out that in order to flexibly configure the program for a different number of tested symbols, you have to bluntly fill, for example, 21 pieces of code (all the symbols), and then by method of choice of input parameters to pass this or that code fragment. I did the same without OOP, but all the handles and indicator values in the init were written into dynamic arrays, and then OnTick already used these arrays. So, I haven't see any advantages of OOP yet?

P S. I didn't write it accurately. I have to cram so many pieces of code, how many characters at once I'm going to test. Maybe there is a way to dynamically connect the data (handlers and indicator values) during setup for the number of characters working simultaneously. The problem is that all this should be plugged in Init and used in OnTic/OnTimer.

Files:
Master02_ML.mq5  20 kb
 
Erm955:

It is necessary to redefine Init() method, excluding the check for the working symbol. And p.2 does not fit, because the Init() method, among other things, checks for the number of digits Digits, and if the work symbol has 5 digits, and the one being tested has 3 digits, then there will be an error with stops/profits. I inherited and overridden. Everything works now.

Of course, I'm not a great expert on OOP, but it turns out that in order to flexibly configure the program for a different number of tested symbols, you have to bluntly fill, for example, 21 pieces of code (all the symbols), and then by method of choice of input parameters to pass this or that code section. I did the same without OOP, but all the handles and indicator values in the init were written into dynamic arrays, and then OnTick already used these arrays. So, I haven't see any advantages of OOP yet?

P S. I didn't write it accurately. I have to cram so many pieces of code, how many characters at once I'm going to test. Maybe there is a way to dynamically connect the data (handlers and indicator values) in the course of tuning for the number of characters working simultaneously. The problem is that all this should be plugged in Init and used in OnTic/OnTimer.

It's like this. By the way, thanks for the tip on point 2. I'll add control and change the number of characters.
 
uncleVic:
It is so. By the way, thanks for the tip on point 2. I will add a control and change of digits.

Shit! Just got it all set up and when I upgraded to 485 build, the error popped up again:

2011.08.08 17:13:04 Core 1 tester stopped because OnInit critical error
2011.08.08 17:13:04 Core 1 2010.01.01 00:00:00 OnInit: error initializing indicators
2011.08.08 17:13:04 Core 1 2010.01.01 00:00:00 CExpert::InitIndicators: error initializing indicators of money object
2011.08.08 17:13:04 Core 1 2010.01.01 00:00:00 CExpertBase::InitIndicators: parameters of setting are not checked
2011.08.08 17:13:04 Core 1 2010.01.01 00:00:00 CExpertBase::SetOtherSeries: changing of timeseries is forbidden
2011.08.08 17:13:04 Core 1 2010.01.01 00:00:00 CExpertBase::SetPriceSeries: changing of timeseries is forbidden
2011.08.08 17:13:04 Core 1 EURUSD,H4: history begins from 2009.01.02 04:00
2011.08.08 17:13:04 Core 1 EURUSD,H4: history cache reserved for estimated 4692 bars

Files:
Master02_ML.mq5  20 kb
 
Erm955:

Shit! Just got it all set up and when I upgraded to 485 the error popped up again:

Have the agents updated? Is the EA recompiled in the new version?
 
Rosh:
Have the agents been updated? Has the EA been recompiled in the new version?

That's just it, I've recompiled!

Reason: