[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 470
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
Разные приёмы? Какие, например?if (NormalizeDouble(a, 4)==NormalizeDouble(b, 4)) { ... }
if (NormalizeDouble(a, 4)==NormalizeDouble(b, 4)) { ... }
I tried that too, and just in case, instead of Digits I wrote 4, then 5, then 6... Doesn't work!
https://www.mql5.com/ru/articles/1561
Thank you! Indeed, the article is very informative. But I didn't find the bool CompareDoubles function in MetaEditor...
https://www.mql5.com/ru/articles/1561
Or perhaps I don't quite understand, or rather don't understand what a library is at all?
Or perhaps I don't quite understand, or rather don't understand what a library is at all?
A function for comparing real numbersCould you please tell me what to do here?
I want to read numbers from a file into the corresponding arrays.
The numbers in the file are as follows: 1.2121;1.2323;1.3434;1.4545
I prepare the following arrays for them: double s1[], s2[], r1[], r2[]
at the stage of initialization I read as follows
but, unfortunately, the arrays are not filled in...
Advise how to be here....
Посоветуйте, как тут быть....
First, in csv files, elements are separated by "," not ";"
Second, you must fill arrays with the first element of each file line, because you first retrieve the entire line with FileReadString, then convert it to a single real number, and the next FileRead command already works on the next line of the file.
You can arrange reading in the following way:
for(;;) {
str=FileReadString(Handle);
s1[k] =StrToDouble(StringSubstr(str,0,6));
s2[k] =StrToDouble(StringSubstr(str,7,6));
r1[k] =StrToDouble(StringSubstr(str,14,6));
r2[k] =StrToDouble(StringSubstr(str,21,6));
k++;
if(FileIsEnding(Handle)) break;
}
It should work... but not sure :)
Firstly, in csv files the elements are separated by "," not ";".
Secondly, arrays must be filled with the first element of each file string, because you first retrieve the entire string with FileReadString command, then convert the entire string to a single real number, and the next command FileRead already works with the next line of the file.
You can organise reading this way:
for(;;) {
str=FileReadString(Handle);
s1[k] =StrToDouble(StringSubstr(str,0,6));
s2[k] =StrToDouble(StringSubstr(str,7,6));
r1[k] =StrToDouble(StringSubstr(str,14,6));
r2[k] =StrToDouble(StringSubstr(str,21,6));
k++;
if(FileIsEnding(Handle)) break;
}
Should work... but not sure :)
The default delimiter is ";", although you can use any delimiter.You're writing something wrong...
The default delimiter is ";", though you can use any.CSV - Comma Separated Values. The "," is the default delimiter. Separating with ";" is much less common, and I'm not sure it's supported at all in MQL4.
You're writing something wrong...
What exactly don't you like about what I write...?