Features of the mql5 language, subtleties and tricks - page 142

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
In order to reduce the number of optimization overshoots, I use two methods to create a non-linear scale.
To enumerate the duration in hours with sufficient accuracy:
To enumerate, for example, the SAR step with an accuracy of 2 digits (~1%):
Optimising from 0.0001 to 0.99 would require almost 10K steps. Using codes 001-299 in the optimisation would require less than 300 steps.
The error is clear in fact. But while writing code like this, it is not always obvious that such a check is not enough to avoid division by zero.
An excuse not to use the ternary operator.
For if similar, of course.
Just don't expect that if there is no value, it is necessarily 0 and therefore false if it is not a bool-type variable. Even an explicit conversion to bool type will not save it.
It works this way without errors.
Forum on trading, automated trading systems and trading strategies testing
Peculiarities of mql5, tips and tricks
Alexey Viktorov, 2019.10.28 10:22
You just don't expect that if there is no value, it is necessarily 0 and therefore false if it is not a bool type variable. Even explicit conversion to bool type will not save.
It works this way without errors.
I can't see the highlight. What is the error?
You wrote "==", it should be "!=".
It's underlined "very pale yellow" :)
You wrote "==", it should be "!="
It's underlined "very pale yellow" :)
Well, not everyone knows I'm like that monkey, "I'm weak in the eyes when I'm old."
I guess so, but for some reason it worked without division by 0. And in general, my message was that we shouldn't check any variable for 0 as a boolean for false.
I guess so, but for some reason it worked without division by 0.
Because TickValue is not zero.