Discussion of article "Migrating from MQL4 to MQL5" - page 2

 
Interesting article, thank you.
 
Quantum:

Mistakes can be made, the material is quite large.

The topic of porting (more precisely, the topic of writing an emulator class with MQL4 methods) was undertaken in another article (we hope it will be finished). In the process of reading the material, we asked the author to write an article in the form of a reference book to cover all MQL4 functions (except for trading - you will soon see one of the solutions for them), to provide an analogue for each of them in MQL5, in general, to put it all together so that those who rewrite MQL4 programs could quickly find an analogue. About the unrestrained desire, if we are talking about the number of sections considered - we insisted on covering all the functions (they turned out to be more than 250).

As for the comparison of functions in some sections - it was not exactly a comparison. It was necessary to give an analogue, even if it is the same. For all functions. So it seems that there is a comparison, but you can tell from the comparison that, for example, the maths functions are the same. By the way, as a recommendation, it would probably be useful to mention this at the beginning of each section, which is something to look out for.

For this reason (architecture of emulator functions) the author had some non-obvious things in the implementation (for example for iLowest/iHighest global Open[]...High[]..., which were declared globally beforehand and made AsSeries in OnInit), which were implied as in the emulator, naturally for universality in functions it is better to use local arrays.

As for working with technical indicators, there can be many questions, working with them should not be like in MQL4 - it is better to create them manually in OnInit and refer to descriptors, instead of creating them each time in local functions. But the approach suggested by the author also works, because the terminal does not immediately destroy indicators. So there are a lot of subtleties.

The important thing is that now there is something to discuss, if you find errors (including those caused by the proposed structure of functions) - offer your variants.

if this is a reference book, let it be a reference book!!!

or it's not fish and meat


why global arrays are used for intermediate calculations!

It is possible to allocate space for such calculations inside a function. why put a reference?

in some functions they are modified your atas.

the same yahigest again!!! modifying the global buffer inside a function is atas!

Well, although it has already been fixed while I was writing, but I'm sure this style will be traced throughout the article.

When the mcl4 price construct accesses these arrays it will find.....


next we have 6 sections of comparisons!

mcl4 functions to mcl4

just comparisons.


Then out of the blue it starts

function replacement table.

2 sections


then again a comparison

3 sections


then the substitutions

functions!

and then again....

First in the table there is the µl4 function and then 2 kinds of cells.

which contains a substitute rewritten to mcl5.

or, 2 types of cells, just an identical function.

and this is throughout the whole article... so is it a transfer to µl4 or a reference book.

leave one thing alone!


There are also many flaws that will lead to a non-working state.

because I've already learnt a lot about the peculiarities of storing data in µl5 arrays.

and in many functions it will be necessary, I would even say it is necessary to determine the size of the array,

some of them will have to determine the direction of indexing.

because of the difference of data processing in the mcl4 and mcl5 environment.

because I can already feel that it will compile, but it won't start.


Of course, such a guide you are talking about would be very useful indeed.

There are a couple of interesting points in the article

but it's neither fish nor flesh.


Leave without replacements just a function and its analogue on mql5.

this will be useful for a complete rewrite of the mql4 indicator to mql5.

with all references to documentation!

to hell with these crude substitutes.


of course, sorry for such a harsh criticism, but to release such a raw article when it is most expected.

with such critical errors.

what will be learnt from it....

clearly heresy...


And lastly, why are there no attachments???

If so many functions have been moved, why is there no .mqh file?

where all the functions would be collected... especially 250 of them... copy 1 by 1 to transfer mqh4 ....

again suggests that the author is deliberately trying to hide something.


Regards Vasily.

 
CoreWinTT:
...

because I can already smell that it's compiling, but it won't start.

...

Indeed, writing a function that will compile without errors does not mean that you can safely include it into your code. The biggest problem is to translate the programme logic. It is like translating poetry: you have translated it verbatim, but it does not rhyme. That's why it is not enough just to translate functions. The task of converting from one language to another is not as simple as it may seem.

I see a solution in the form of an emulator with a simple and clear mechanism for transferring indicators, scripts and Expert Advisors to MQL5. I am currently working on it.

 
yep cool emule will be =)
 
CoreWinTT:

If it's a guidebook, let it be a guidebook!!!

It's not fish and chips.

....

Vasily, thank you for your constructive criticism, I hope the author will take into account the wishes and provide variants of self-sufficient functions without the use of global arrays.

The article was intended to be a reference - to provide correspondences between MQL4 and MQL5 functions.

This is probably the reason for the impression that the author is trying to hide something: minimum explanations, a lot of tables, no complete examples of use. But this is a specificity of the genre.

There are many subtleties of working with functions, the details should be considered in detail and with examples, but these are the topics of other articles - we hope they will appear. The topic of migration from MQL4 is far from being exhausted by this article, a lot of interesting materials are being prepared and will be published soon.
.

 
DC2008:

It should be understood as follows: the implementation is too complicated and not justified. After all, the goal is to completely abandon MQL4 functions.

Exactly. The point is to explain what (other) tools should be used now, due to what changes in the system architecture. Since this material is given as a reference book, it is important to fill all the cells in it with "solution". If there is no analogue, then there is another approach.
 
marketeer:
Exactly. The point is to explain what (other) means should be used now, due to what changes in the system architecture. Since this material is given in the form of a reference book, it is important to fill all the cells in it with a "solution". If there is no analogue, then there is another approach.

It's difficult to read a book on each indicator at least.

Even I can't boast of that.

 
marketeer:
... it's important to fill all the boxes with "solution". No analogue means there is another approach.

Section 17 is added with a reference to the "solution".

Suggest which features "without analogues" to pay attention to first, because not all of them are so relevant and necessary. I will try to make changes.

 

17 is good. About the first turn - it's not for me to judge. Everyone who will convert mql4 to mql5 will have their own queue. In order not to miss anything, I would simply fill in the order from top to bottom, starting with AccountFreeMarginCheck, AccountFreeMarginMode, ArrayCopyRates, ArrayDimension, etc (there are only 9 of them left).

[Deleted]  
Quantum:

Dear Vasily!

Thank you for your comments, the functions of section 18 have been updated. Please check the current version.

The author has done a lot of work, there may be errors, we will fix them together.

The TFMigrate(int tf) function is needed to substitute correct values of MQL5 timeframes. For example, in MQL4 the numerical value of the PERIOD_H1 constant is 60, and in MQL5 the numerical value of PERIOD_H1=16385, i.e. TFMigrate(60)=16385.

In my opinion, two functions are necessary to work with TF in migration conditions:

1. Converts the number of seconds to TF - say ENUM_TIMEFRAMES SecondToPeriod (int Value);

2. Converts the period into seconds - say int PeriodToSecond(ENUM_TIMEFRAMES Value).


Which I successfully did in my migration module at the very beginning (there is also a DLL option).


PS

To maximise compliance with MQL4, I personally got rid of all non-standard for it periods