MathMod() is division. The rest is pure mathematics: if the result of TimeLocal() is divided by 20 every second (or more often), then every 20 seconds the remainder will be zero.
Conclusion: the same idea can be implemented in different ways.
Why do I have to do it every 20 seconds? Why not at 19 or 17?
bool flag = true; int i=0; int w=0; double sum;
int t=20;
int start() { sum=TimeLocal() / t;
if (flag) { while(i<20) {
w=w+1; Alert(+w,"-й, Результат TimeLocal-",+sum); i++; sum=sum/20; Sleep(1000);
} flag = false; } return(0); }
Here it equals zero every 11 seconds. Divided by 20, 20 times.
Sorry for the nubian questions, it's just something I want to understand .
How does it happen that it turns exactly zero in 20 seconds . See the local time under the number 8000000000... What's the tricky part? Maybe I just need to take a break, eh....
int i=0; int e; int w=0; int start()
{ while(true) { e=MathMod(TimeLocal(), 20); w=w+1; Alert(+w,"-й, Результат MathMod-",+e);
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I.e. you need this function F(8,5464.00) = 85464.00
MathMod() is division. The rest is pure mathematics: if the result of TimeLocal() is divided by 20 every second (or more often), then every 20 seconds the remainder will be zero.
Conclusion: the same idea can be implemented in different ways.
Why do I have to do it every 20 seconds? Why not at 19 or 17?
bool flag = true;
int i=0;
int w=0;
double sum;
int t=20;
int start()
{
sum=TimeLocal() / t;
if (flag)
{
while(i<20)
{
w=w+1;
Alert(+w,"-й, Результат TimeLocal-",+sum);
i++;
sum=sum/20;
Sleep(1000);
}
flag = false;
}
return(0);
}
Here it equals zero every 11 seconds. Divided by 20, 20 times.
Sorry for the nubian questions, it's just something I want to understand .
Why do you divide by 20 times exactly?
You have to divide until you win ;)
8.5464/0.0001=85464
Thank you.
But that's not what I meant, the comma is the triad separator and the dot separates the fractional part.
I have a string 8,5464.00 I need to convert it to a number. StrToDouble(8,5464.00) takes 8.
F(8,5464.00) = 85464.00
try this function
{
search for a comma via https://docs.mql4.com/ru/strings/StringFind
Assembling a new string from two parts: a string before the comma and a string after the comma https://docs.mql4.com/ru/strings/StringGetChar
Convert to number StrToDouble()
}
Here's a prime example, just like you said.
Hmmm...
How does it happen that it turns exactly zero in 20 seconds . See the local time under the number 8000000000... What's the tricky part? Maybe I just need to take a break, eh....
int i=0;
int e;
int w=0;
int start()
{
while(true)
{
e=MathMod(TimeLocal(), 20);
w=w+1;
Alert(+w,"-й, Результат MathMod-",+e);
Sleep(1000); // Спим 1-ну секунду
return(0);
}
try this function
{
search for a comma via https://docs.mql4.com/ru/strings/StringFind
Assembling a new string from two parts: a string before the comma and a string after the comma https://docs.mql4.com/ru/strings/StringGetChar
Convert to number StrToDouble()
}
Isn't there any other way or will this function take a long time to run.
If MathMod(EVERYTHING, 20) = 0, it means (if memory serves me correctly)
that EVERY NUMBER is divided by 20 without a remainder.
20 40 60 80 100 120 140 160 etc.
Is there no other way or will this function take a long time.
I don't know how else to take the comma out of the string.
Thank you.
But that's not what I meant by a comma separating the triads, and a dot separates the fractional parts.
I have a string 8,5464.00 I need to convert it to a number. StrToDouble(8,5464.00) will change to 8.
F(8,5464.00) = 85464.00
By character, through string functions, remove the comma, then StrToDouble().