Tester supporting MG4 scripts and advisors - page 4

 

You can all bang your heads against the wall, or invent warm water.... ButInteger is right.

Integer:

Exactly. Especially taking advantage of the authority of one's superior position.

All languages are the same, except for the extravagant ones. All of them can be learned in 21 days by any dummy. All for, while, if, switch may have a different notation, but it doesn't make any difference in principle. It is not the way the operators are written that is of importance, but the infrastructure with which the language interacts. In this respect MT4 and MT5 are two different worlds.

The difference in everything. Starting with the small - with the numbering of the bars in the indicator, in MT4 from right to left, in MT5 from left to right. Continuing with the more significant one - the aggregate position and the organization of the trade history data. The biggest difference in what is often required - in the way of accessing data quotes and indicators, the copying of data requires checking, then indexing from left to right, then from right to left, the time of the bar is either included in the range, or not. Take alone the discussion of the iBarShift() function in CodeBase.

In MT4, to ensure the stable operation of the EA it was sufficient to check the return value of OrderSelect(), but in MT5 it is necessary to do checks at every step, even at data of the last tick. There are also some subtleties of MT5 programming, which you will learn only after you have suffered a lot, because there are many pitfalls.


 
Renat:

What you don't see on this forum.

Why, there's no responsibility. You can say anything.

The languages are still different. The code of an indicator for five will not always work in four. There is not enough capacity
 
Vinin:
The languages are still different. The indicator code for five will not always work in four. There is not enough capacity
Better that indicator codes for 4 will still work in 4. And there will be no need for features
 
borilunad:
It would be better if the indicator codes for 4 still worked in 4. And there would be no need for features.
They do work. Unless they are modified or recompiled
 
Vinin:
They do work. Unless you modify or recompile them.
I didn't change anything in "Theme", but when the Terminal was updated from 670th to 711th build, it became sluggish with any of them in the tester, that's why I reported it, but I started experimenting with the standard MA and found many things which I couldn't before by inexperience. Now I work with it and am happy with it. Only dissatisfied with my purchase of an 8, which is called a disaster, and planned to work on it only, and on Vista all the rest. I guess I will have to continue on Vista while it survives and then buy it without trusting anyone and I will let this 8-th for soap, web-sites etc. :)
 
Renat:

MetaTrader 4 has limited depth of history, separate timeframes and direct access to its symbol bars via Open/High/Low/Close/Time[xxx]. Such direct access is very expensive to implement in terms of resources and CPU cost. Consider that each Expert Advisor has its own local copy of this data to avoid conflicts with other Expert Advisors and the terminal itself.

This is not really a user problem, it is your problem. I.e. you could say you are shifting the terminal's data access problems onto the user.

I.e. you either raise the bar of coding skills or get a lot of invalid code which can be worse and more inefficient than direct convenient access in MT4.

In fact, some of your solutions are very controversial.

 
TheXpert:

This is not really a user problem, it is your problem. So you could say you're shifting the terminal's data access problems onto the user.

I.e. you either raise the bar of coding skills or get a bunch of crooked code which may work much worse and ineffective than direct convenient access in MT4.

In general, some of your solutions are very controversial.


Read the whole text - there is a direct reasoning why it is impossible to use it further.

So that the user does not blame us later for brakes or excessive use of resources, we have given more effective control over the requested data.

A simple example: an Expert Advisor on Eurodollar M1 with a history of 10 years, the current chart takes about 200 mb. In the MT4 model we would have to replicate (even sparingly) in each tick 200 mb into expert's shadow snapshot and we would lose 200 mb of memory. In MT5 there is no memory consumption for such cache at all, and the Expert Advisor will most likely request only a small piece of history, put it in a local array and work with it at maximum speed.

 
Renat:

To prevent the user from blaming us later for lags or excessive resource consumption, we have given more effective control over the requested data.

I read the whole text. It's not impossible. You collect timeframes for charts, you could collect them for Expert Advisors in the same way, and do it quite effectively.

What makes you think that the user would be killing you for braking?

In the MT4 model we would have to replicate (even sparingly) at every tick 200 Mb to shadow snapshot of EA and waste 200 Mb of memory. MT5 has no memory expenses for such a cache at all, and the Expert Advisor will probably request only a small chunk of history, store it in a local array and work with it at maximum speed.

Make a smart cache (there is experience), don't keep the rest in memory.
 

Write your own terminal engine with an internal efficient ecosystem and virtual machine, and then we'll talk. We've written the last four platforms like this, improving the architecture time after time. So our decisions are justified by practical experience.

Otherwise, it is impossible to respond to the advice "do it, smart cache, they won't be abused, etc.".

 
Integer:

Exactly. Especially taking advantage of the authority of one's superior position.

All languages are the same, except for the particularly extravagant ones. All of them can be learned in 21 days by any dummy. All for, while, if, switch may have a different notation, but it does not fundamentally change anything. It is not the way the operators are written that is of importance, but the infrastructure with which the language interacts. In this respect MT4 and MT5 are two different worlds.

There is a difference in everything. Starting with a minor one - with the numbering of bars in the indicator, in MT4 from right to left, in MT5 from left to right.

...

Numbering in MT5 is reversed compared to MT4 only by default. In fact, arrays can be reversed in any direction. See documentation: Indexing direction in arrays, buffers and timeseries.

Integer:

...

Continuing with the more essential - the aggregate position and the organization of trade history data.

...

And on MT4 there were a lot of problems because we had to cover opposite positions of instruments by sending an extra order to the server through OrderCloseBy() which didn't always work due to various reasons. Therefore, we had to additionally check and resend orders otherwise the entire logic of the trading system was broken.

In MT5, due to the aggregate position, everything has been simplified to an acceptable level. Now, for example, we do not even have to worry about what the breakeven level should be - this stupid question is only relevant on MT4. After all, the open price of an aggregate position is the Breakeven level. Everything has become simpler with winning positions, because they are automatically closed on the server without sending additional orders.

I.e. at the expense of aggregate pose, the amount of code has been reduced to the necessary and sufficient level, as well as the amount of redundant orders and checks required for them.

Integer:

In MT4 it was enough to check the return value of OrderSelect(), while in MT5 it is necessary to do checks at every step, even at data of the last tick. There are some more subtleties of MT5 programming, which you will learn only after you have suffered a lot, because there are a lot of pitfalls.

No one is forcing to use additional checks in MT5, you can hope the same as in MT4 and try to process any stuff without checks, which hasn't been loaded from the server correctly or hasn't been loaded at all, but has just initialized. In this case the performance will also correspond to MT4, i.e. everything will be fine only in the tester, and we'll see nonsense on demo and real account.

That is the increase of the number of additional checks in MT5 is intended for making sure of the quality of obtained information. In MT4 a lot of such checks are absent, so in some critical cases it is impossible to make sure the information received from the terminal, which needs to be processed for making a decision, is reliable. You can only hope that the terminal has downloaded everything needed from the server correctly, but there is no way to be sure of that - there is nothing to check for the correctness.


Generally speaking, an attack on MT5 - is just a rotten excuse for those who do not want to switch to a new terminal or an invention of those who have only heard of MT5, but do not know where it is.

MT4 is the terminal of yesterday for creating primitive algorithms that are more or less suitable for "trading" in the tester for drawing nice balance curves. If you are not interested in drawing nice balance curves, because you cannot put them in your pocket and put them on your bread, and can only use them for bragging in the rustic thread, you need to switch to MT5.