In the case of both warnings, it is referring to the implicit type-casting of the value returned by MathMin, which returns a double, into a ulong or int which will suffer the loss of the decimal part of the returned value.
double MathMin( double value1, // first value double value2 // second value );
In the case of both warnings, it is referring to the type-casting of the value returned by MathMin, which returns a double, into a ulong or int which will suffer the loss of the decimal part of the returned value.
Yes, actually thats what I expected, but that is not sufficient enough - Take a look at the attached file please....
I dont understand when the return value is double and when it is not...
You will need to fix the file. It does not compile because the OnInit function declaration is incomplete. You need to close the parameter bracket.
void OnInit() // ← Was missing the closing round bracket {
For the functions that don't give a typecasting warning, it is probably because that function is overloaded, even if not mentioned in the documentation.
For example MathAbs(), although not documented, when one is typing it out, the auto-substitution shows that the function is overloaded ...
You will need to fix the file. It does not compile because the OnInit function declaration is incomplete. You need to close the parameter bracket.
For the functions that don't give a typecasting warning, it is probably because that function is overloaded, even if not mentioned in the documentation.
For example MathAbs(), although not documented, when one is typing it out, the intelisense shows that the function is overloaded ...
Sorry for the missing bracet, I typed it as a wrapper...
I see, yes, thats what I suspected, but as you can see, MathAbs(short) returns int, and MathAbs(ushort) returns ushort....
My question is, what type of rules are used to determine the return type... - Background is, I am currently trying to replicate these function-signatures and I would like to have an exact copy, but without blindly copying them, but rather understanding the logic behind it....
Sorry for the missing bracet, I typed it as a wrapper...
I see, yes, thats what I suspected, but as you can see, MathAbs(short) returns int, and MathAbs(ushort) returns ushort....
My question is, what type of rules are used to determine the return type... - Background is, I am currently trying to replicate these function-signatures and I would like to have an exact copy, but without blindly copying them, but rather understanding the logic behind it....
The basic typecasting rules are ...
A short fits in int, so there is no warning, but and int does not fit in a short, so a warning will be given.
As for the available overloading combinations of the MathAbs, it all depends on what overloaded declarations were defined by MetaQuotes "under the hood", given that they did not document them.
You will have to look at the auto-substitution or run multiple tests to find out (trial-and-error method).
The basic typecasting rules are ...
A short fits in int, so there is no warning, but and int does not fit in a short, so a warning will be given.
As for the available overloading combinations of the MathAbs, it all depends on what overloaded declarations were defined by MetaQuotes "under the hood", given that they did not document them.
You will have to look at the auto-substitution or run multiple tests to find out (trial-and-error method).
Yes, it is ...
void OnStart() { string sA = "AAA", sB = "BBB"; string sC = MathMax( sA, sB ); Print( "sC = ", sC ); };
2023.05.04 22:03:06.241 TestString (EURUSD,H1) sC = BBB
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
It is obvious, documentation has not all details in this case, I am trying to get behind whats actually coded here.
I have written following test to find out... now I am maximal confused.
Could anyone please shed some light on this?