Errors, bugs, questions - page 2000
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
And it makes no sense to do this already in OnCalculate. There is no reason to initialize the array with something and then fill it with some values from the formula? When you add a bar, and respectively an array cell, what is the point of filling it with something and then immediately with a value from the formula or an empty value?
This is if the formula is applied on all bars. What if it only applies to the last one? I, for example, have plenty of indices that allow me to set the number of bars to be calculated, as the calculations can be heavy. Initialization is required.
In general, if you don't want to do it, don't do it. I am not discussing it any more. ;-)
So it's not about ArrayResize, it's about ArrayInitialize. ArrayResize guarantees zeros in MT4.
But what if you read it carefully? Let me quote it again.
Initialization of an array with expressionArrayInitialize(array, init_val) doesn't mean initialization of elements of the reserve allocated for this array with the same value. When ArrayResize() function subsequently increases the size of the array within the current reserve, the elements whose values are not defined and most often are not equal toinit_val are added to the end of the array.
And if you read it carefully? I'll quote it again.
Initialization of an array with expressionArrayInitialize(array, init_val) doesn't mean initialization of elements of the reserve, allocated for this array. When ArrayResize() function subsequently increases the size of the array within the current reserve, the elements whose values are not defined and most often are not equal toinit_val are added to the end of the array .
And why make up such unrealistic scenarios, essentially MQL programmer errors? Obviously, full initialisation is only done once, or if a data dump is detected. In that case, it would be more efficiently done by the kernel.
Where did I say about double initialization? Just about the same, mentioned above, filling of all elements in a loop, I was talking about. If it's present, initialization is unnecessary and only wastes resources.
Well, and if you're not counting all bars, then take care of filling with zeros yourself.
This is if the formula is applied on all bars. What if it only applies to the last one? I, for example, have plenty of indices that allow me to set the number of bars to be calculated, as the calculations can be heavy. Initialization is required.
In general, if you don't want to do it, don't do it. I am not discussing it any more. ;-)
Here are golden words... But it's better to say "where we don't have to, we won't do it". Or vice versa "we will only do it where it is necessary".
Only new array elements are initialised. And the point is still the same - identical results from run to run, even if there is an error in the code (often not your own).I gave an example with the math library above.
Rubbish is evil.
I can't even find decent words to comment it.
If you are asked to smear yourself with it... I don't think you'd go for it. Let's say the first time you don't know what it is, then the second time?
Why are you asking the developers to protect you from crap? Protect yourself. Or if you have irrefutable arguments that it is necessary, then do not hide them from the public.
You know, mql3 was a place where you could write so many mistakes that it would make your hair stand on end... And the EA does not matter, it works anyway... Does it work right? Who cares?
For some reason there's no argument about going outside the array. And it would seem that this is a lesser evil than trash in an array or a variable. Well, we don't have such an index in the array as it used to be, so be my guest and let's go on working. hands, let's get back to work. It's all worked out...
So why are you demanding developers protect you from crap? Protect yourself. Or if there are compelling arguments for doing so, then don't hide them from the public.
There were no demands, irrefutability is shown.
Forum on trading, automated trading systems and testing of trading strategies
Bugs, bugs, questions
fxsaber, 2017.09.12 16:17
In MT4 it will always return false, because without rubbish it's all zeros. In MT5 it is true.
So the same code in MT4 tester will always show identical results from run to run. In an MT5 tester it will not.
There was no requirement, irrefutability is shown
Who forbids adding just one line?
Or don't you know that false is 0, everything else is true regardless of the sign? You take values from array reserves and want to make sure there's 0. Well, in that case it's reasonable to initialize the array with zeros, but why burden the system with forced nulling when you don't have to?
Sorry, but this example is absolute nonsense.
Who forbids adding just one line?
This is not about me.
Forum on trading, automated trading systems and strategy testing
Bugs, bugs, questions
fxsaber, 2017.09.12 16:52
It's horrifying to think that some math library (Include\Math -7Mb source code) hasn't initialised in one/two places! And how to dig out this error, which in MT5 tester gives different single runs and in MT4 the same runs?
It's not about me.
The only thing left to do is to give up all other people's libraries. And I've never looked at this particular one, let alone used it. It's easier to write everything you need than to dig through a pile to check for bugs... And to use just two or three functions...