
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
More reliable? Why is getting handles at initialisation not reliable? Why is it unreliable to check for necessary data? And even more so, why is the presence of checks not reliable?
For beginners it may not be so easy, but with time everything will become clear...
In fact, I'm trying to figure it out right away, not later... I don't want to just copy some actions without understanding their meaning. If I've got the code as a built-in function like in MQL4, I will probably add some extra parameter with number of bars.
Why does it load?
"Ordinary numbers" are constant expressions that also have a type. In this case it is int type.
An expression consisting of a multiplication of two subexpressions, each of int type, is also of int type. This is where the overflow occurs.
And only then the implicit conversion from the int expression's type to the long type occurs during the initialization of the long variable.
Everything is clear here. By the way, it is not necessary to cast each of the operands to long in this case. We can just cast one and implicitly cast the second.
This is what I was trying to say, but using less academic language. The main thing is to warn other observers.
The question is different. Where in what Talmud does it say that :
"Ordinary numbers" are constant expressions that also have a type. In this case it is int type.
For example, if X is set to 10000000000 , then it becomes long type ? And why not ulong or datetime or even string.?
What is the type of number 255uchar orshort ?
Why does it load?
There seems to be a mix-up between the log and the code. The above code works "clean". And, to get such a log, I had to make variables A and B of int or uint type, and variable X of uint type:
And here is work of original code:
Build 314 (20 Aug 2010).
I cited a different code
Pay special attention to the first line, your account may have a different number. Look it up and put it in long C =
Checked result again
Build 314 (20 Aug 2010).
Please tell me why the SymbolInfoDouble(_Symbol,SYMBOL_POINT) function of USDCHF pair produces a five-digit point size after the decimal point 0.00001, when this pair is accepted for the point value 0.0001?
What makes you think there are 4 digits in this instrument, the terminal clearly shows that the quotes there are 5 digits
This function can return different point values even in accounts with five digits, it all depends on the settings that will be accepted by the broker.
For example, one brokerage company has the following comment
and another one has 1 pips equal to the fifth digit.
That's what I was trying to say, but in less academic terms. And most importantly to warn other seekers.
The question is different. Where in which Talmud does it say that :
"Ordinary numbers" are constant expressions, which also have a type. In this case it is int type.
For example, if X is set to 10000000000 , then it becomes long type ? And why not ulong or datetime or even string.?
What is the type of number 255uchar orshort ?
The constant 10000000000 is already of type long.
How should I put it? Normal languages have suffixes-modifiers that allow you to specify the type of constant without using an explicit type conversion. For MQL5, I have only found it for float. Therefore, it is impossible to define constants of uchar, ushort, uint, ulong, char, short and long types (if the constant value fits into int type) without explicit type conversion.
The constant 255 has an int type. You can find something in the type descriptions, for example, character constants are declared as having type ushort. There is also information about constants of datetime type, color type, bool type, double type and string type.
You may try to print the size of the constant type, as long as the sizeof operation is introduced (but why is it introduced, please explain to one of developers):
In general, only f for double-constants works by modifying them to float, which can be seen by the size of such a constant type.
Here, the only sensible use of sizeof operation I could find. :)
I gave you a different code
Pay special attention to the first line, there may be a different number on your account. Look it up and put it in long C =
Checked the result again
Build 314 (20 Aug 2010).
No, I don't have the same effect as you do. I have only to check the bit versions of MT5. I have the 64-bit version, what is yours?
By the way, does the modified code I have tested give you the same results as I do?
If yes, then what I see is very similar to that bug about "origin" of a value - i.e. the code can behave differently (both correctly and incorrectly) depending on where the value on which the further calculations are based originally came from.