MathIsValidNumber doesn't work that way. It wouldn't understand "Four" as 4 anymore than "four" or "FOUR" or "vier" or "quatre" or "quatro".
If you cast "Four" as a double, the result is 0.
As 0 is a valid number, your function returns true.
You will need to build in your own conversions of words to numbers if you want to achieve that.
Your compiler should have warned you about an implicit conversion ... do you have
at the top of your code?
MathIsValidNumber doesn't work that way. It wouldn't understand "Four" as 4 anymore than "four" or "FOUR" or "vier" or "quatre" or "quatro".
If you cast "Four" as a double, the result is 0.
As 0 is a valid number, your function returns true.
You will need to build in your own conversions of words to numbers if you want to achieve that.
Your compiler should have warned you about an implicit conversion ... do you have
at the top of your code?
I think you don't understand the answer
If you push a string like "Four" or "banana" or "MetaQuotes" into a double the result is 0.
0 is a valid number.
If you were using #property strict your compiler would have alerted you to this issue.
You can test that the "number" is not 0, but you can't trap whether it was deliberately entered as 0, or it was just converted to 0 in the casting.
double as_double = (double) ObjectGetString(0,"SimultaneousReleaseIndex",OBJPROP_TEXT);
if(as_double !=0 && MathIsValidNumber(as_double)) Print("Object Text Is Numeric");
I think you don't understand the answer
If you push a string like "Four" or "banana" or "MetaQuotes" into a double the result is 0.
0 is a valid number.
If you were using #property strict your compiler would have alerted you to this issue.
Please read my post again.
Do you agree that 0 is a valid number?
Please read my post again.
Do you agree that 0 is a valid number?
Of course, 0 is a valid number
So which bit of my answer don't you understand?
To re-iterate again:
If you cast "Four" as a double, the result is 0.
As 0 is a valid number, your function returns true.
If you push a string like "Four" or "banana" or "MetaQuotes" into a double the result is 0.
0 is a valid number.
So which bit of my answer don't you understand?
If I said make a number out of "sdgfjhsdfkjdshfkjsfdhskdjh" what number would you give me?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
if (MathIsValidNumber(ObjectGetString(0,"SimultaneousReleaseIndex",OBJPROP_TEXT))==true){Print("Object Text Is Numeric");}