Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 108

 
-Aleks-:

So, I have such a probe - you can put a line in long, but I need double for calculations with a decimal point.

Well, this seems to work fine.

double CalcY=StringToDouble("0.01234567890001");
Print ("CalcY=",DoubleToString(CalcY,14));

2017.02.05 23:52:50.190 00 EURUSD,M1: CalcY=0.01234567890001

 
Vitalie Postolache:

This seems to work fine.

double CalcY=StringToDouble("0.01234567890001");
Print ("CalcY=",DoubleToString(CalcY,14));

I have 18 digits in a number.

 
-Aleks-:

I have 18 digits in a number.

Who has it easy nowadays...

Text output is only up to 16 characters, it's written in black and white in the documentation. And the calculations are up to the limit of the data type.

 
Vitalie Postolache:

Who has it easy nowadays...

Text output is only up to 16 characters, it's written in black and white in the documentation. And calculations - up to the limit provided by the data type.

So I'm talking about calculation - number is just fine without preforming into string. But the double calculation itself with a number is limited, as I understand it, to 15 digits. Or is it 15 digits in both directions - before the decimal point and after?

DBL_MIN

Minimum positive value which can be represented by double

2.2250738585072014e-308

DBL_MAX

Maximum value which can be represented by double type

1.7976931348623158e+308

DBL_EPSILON

The smallest number for which the condition 1.0+DBL_EPSILON != 1.0 is met

2.2204460492503131e-016

DBL_DIG

Number of significant decimal places

15

DBL_MANT_DIG

Number of bits in mantissa

53

DBL_MAX_10_EXP

Maximum decimal value of exponent degree

308

DBL_MAX_EXP

Maximum binary value of exponent degree

1024

DBL_MIN_10_EXP

Minimum Decimal Value of exponent degree

(-307)

DBL_MIN_EXP

Minimum binary value of exponent degree

(-1021)

 
-Aleks-:

I understand that the double with a number is limited to 15 digits. Or is it 15 digits in both directions - before and after the decimal point?

The limit is a maximum of 15 digits, so the comma is irrelevant.

 
int Counter (int type, string sy, enum counterEnum{TIME_1_SY, TOTAL, LOCK})
{
...
}
Please advise, I want to declare an enumeration in function parameters, so that only the following values can be selected as the third parameter when the function is called:
TIME_1_SY, TOTAL or LOCK

How to implement this?

I figured it out, it turned out to be very simple:

enum CE {TIME_1_SY, TOTAL, LOCK};
int Counter (int type, string sy, int counterEnum)
{
...
}
 

Hello, could you please tell me the code for this program

if(ObjectFind("Rectangle 33579")==0) Alert("YES");
else Alert("NO");

It signals several times "YES" then several times "NO" if the object exists and all the time "NO" if the object doesn't, but why such a simaphore when the object exists?

 
Maksym Mudrakov:
int Counter (int type, string sy, enum counterEnum{TIME_1_SY, TOTAL, LOCK})
{
...
}
Please advise, I want to declare an enumeration in function parameters, so that only the following values can be selected as the third parameter when the function is called:
TIME_1_SY, TOTAL or LOCK

How to implement this?
Declare an enumeration in the global scope. And use the enumeration as a parameter type in the function.
 
vivatforex:

Hello, could you tell me please, here is the code of the program

if (ObjectFind("Rectangle 33579")==0) Alert("YES");
else Alert("NO");

It signals several times "YES" then several times "NO" if the object exists and all the time "NO" if the object does not exist, but why such a simaphore when the object exists?

Try it like this:

if (ObjectFind(0,"Rectangle 33579")<0) Alert("НЕТ");
else Alert("ДА");
 

Hi all.

Who can see why it displays like this?

I.e. the functions are different properties but the display is the same.

Also with two other objects of the same type, only one of them works, other parameters are ignored

Files: