Wishes for MQL5 - page 117

 
HideYourRichess писал(а) >>
Trading on an ipod?! - Sorry for God's sake, I should have warned you right away. Please write, state any nonsense - I won't say a word. Now that everything is cleared up - I'll take it with understanding and patience. Trade on an iPod! - aaaaaghit....

Thank you for your sympathy and good luck to you, at least don't progress

 

Just ran into a problem in MT4, please make sure this won't happen in MT5 (haven't checked).


In the very beginning (before init) arrays were set:

xsell[3];

xbuy[3];


Before that an external variable:

extern int Max_Array_Size = 13;


In the start() loop:

ArrayResize(xsell, Max_Array_Size);

ArrayResize(xbuy, Max_Array_Size);


And then the loop for():


for(int kss= Max_Array_Size; kss>0; kss--) {

xbuy[kss] = . . . ;

. . .

}


The same scheme was used in both the sales(Custom Indicator) and purchases module - i.e. the variables are different,

but the principle is the same. At first I wrote everything for sales, compiled it - everything is cool, no problems. Then I copied

The compilation took much longer and the switching between

timeframe switching also took much longer. Disabled sales - nothing has changed, braking.

Left only the sales - runs fast. The compiler didn't complain, only took much longer to run.

Rewatched everything that seemed suspicious, rewrote some parts in purchases - lags!...

Turned out that the problem was in the array dimension: 13 => 0-12, and in the for loop I was trying to feed it 13 as well!


After fixing:

ArrayResize(xsell, Max_Array_Size+1);

ArrayResize(xbuy, Max_Array_Size+1);


both sales and purchases were compiled as they should be and timeframe switching became faster.

But the error should have popped up already during compilation. Finding the cause in such cases

It is not at all easy to find the reason (you may not even be aware of the problem).

And it is not clear why everything was running smoothly in the sales module.

 
chief2000 писал(а) >>

But the error should have been discovered during compilation. Finding the cause in such cases is not easy at all (you may not have known there was a problem).

The compiler cannot and should not track the variable values by definition.

And it's also not clear why everything was running smoothly in the sales module.

Because one error is faster to process than two or more.

 
fwiq >> :

The compiler cannot and should not keep track of variable values by definition.

It's bad if it really is.

After all, it's practically the same as accessing a variable that was not pre-defined.

fwiq wrote >>

Because one error is faster to handle than two or more.

No, it's something else - I told you that when only the sales module was left there was no problem,

and when I removed sales and left only purchases, there was a problem. The difference was very noticeable, even though both modules

are absolutely identical, except for some operations changed to reverse (>/<, High[]/Low[] etc.).

 
chief2000 писал(а) >>

No, it's something else - I told you that when only the sales module was left there was no problem, but when I removed sales and left only purchases there was a problem. The difference was very noticeable, and both modules are absolutely identical, except for some operations changed to reverse (>/<, High[]/Low[] etc.).

Maybe, it's not the definition of variables or arrays. In the MT4 indicators, you should carefully and attentively watch over the moments when you start to add lines programmatically, and change the names of the reflected arrays. Sometimes there is confusion and the line may not be reflected or the calculation may hang up, like in this case. There is only one cure, as in the joke "You just have to go out and come in and everything will work".

 

If literally, overloading didn't help either.

Anyway, it was the distinction between selling and buying that helped me to know there was a problem...

Happiness was a blessing in disguise :)

 
I have another question. I cannot run the MQL5 debugger on indicators. It works on scripts and Expert Advisors but it won't stop on any indicator and cannot go through the steps. I am not sure if there are any undocumented peculiarities, if you know them, please let me know.
 
fwiq >> :
I have another question. I cannot run MQL5 debugger on indicators. It works on scripts and Expert Advisors, but it won't stop on any indicator and cannot go through the steps. I have not been working with this kind of things, I started working with this kind of things.

A week ago the handlers wrote that this was the idea and debugging on the debugger indices will work later

 

In MT4 there were always errors because Ask or Bid or other (Close, Open, etc.) collected after the comma

a huge amount of numbers (like 1.432311111111111111). As a result, we had to add "NormalizeDouble(Bid,Digits);" .

And this can be solved once at MT level.

 

Please add to the ObjectFind and ObjectDeletefunctions the ability to work with masks like : *,?

Inprinciple, of course, only ObjectFind can be used .If it is necessary to keep backward compatibility, the former function should be left unchanged, and the set should be supplemented with, for example, ObjectFindM (multiple search).

Example: we need to find text labels which start with "Signal".

Implementation: Returns name of the first found object (or handle, but this requires other functions that can handle it).

Notation: ObjectFindM("Signal*");

Example: you must remove from the "0" window only those text labels that start with "Signal"

Notation: ObjectDelete(0,"Signal*");