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

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
It was closed from the very first post. When the minimum number is multiplied by something less than one, you get zero.
what would the correct code look like?
What will the right code look like?
Forum on trading, automated trading systems and trading strategies testing
Features of mql5 language, subtleties and tricks
fxsaber, 2019.10.28 11:42
compilation: expression not boolean
not a good option for me
I don't do it myself.
For aesthetes, you can create a DOUBLE structure with appropriate operators. But all this has little to do with practice. In the original practical example.
ForUM on trading, automated trading systems and strategy testing
Features of mql5 language, intricacies and techniques
fxsaber, 2019.10.28 07:24
Way to get caught up in division by zero, even with a check.The error is understandable 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.
You just need to zero the array item being created. It is absence of initialization that causes collisions in this case. That's why I simply made zeroing in my code. I don't want to bother with the general view.
compilation: expression not boolean
not a good option for me
There's something wrong with you.
It's more confusing as to why dividing by zero gives an fpu exception, at least for me.
Something is taking you all the wrong way.
fxsaber:
No problem here
2019.10.28 20:45:47.010 tst1 (EURUSD,H4) 2.224851351121351e-308 --> true
2019.10.28 20:45:47.010 tst1 (EURUSD,H4) -nan --> true
UPD:
check for inf
2019.10.28 22:04:00.163 tst1 (EURUSD,H4) 1. dev = inf ---> false
2019.10.28 22:04:00.163 tst1 (EURUSD,H4) 2. dev = inf ---> true
There's no problem here.
Googled "C++ double zero divide", your code won't work for non-normalised numbers, you need this:
meditation script ))))
Interesting topic. Found something here. Particularly noteworthy in the theory block.
abs(u - v)/abs(u) <= epsilon && abs(u - v)/abs(v) <= epsilon; // (4)
abs(u - v)/abs(u) <= epsilon || abs(u - v)/abs(v) <= epsilon; // (5)
This way all underflow and overflow conditions can be guarded safely. The above however, will not work when v or u is zero. In such cases the solution is to resort to a different algorithm, e.g.(1).
To what? All I see is an idiotic warning, if is absolutely valid.
Boolean conversions
A prvalue of integral, floating-point, unscoped enumeration, pointer, and pointer-to-member types can be converted to a prvalue of type bool.
The value zero (for integral, floating-point, and unscoped enumeration) and the null pointer and the null pointer-to-member values become false. All other values become true.
In general, it is sheer ignorance to write these IsEqual(), IsInf() and IsZerro(). I will not get into the discussion.
To what? All I see is an idiotic warning, if is perfectly valid.
In general, it is complete ignorance to write such IsEqual(), IsInf(), IsZerro(). I will not get into the discussion.
IsInf() and IsNaN() are working,
IsEqual() and IsZerro() are questionable, googled from some sources as "trick for double".