[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 449

 
sergeev:

or as follows


So it turns out that in mql4 it's impossible to execute a cycle once every 20 seconds, regardless of ticks?
 
semiromid:

So it turns out that in mql4 you can't perform a loop every 20 seconds, regardless of ticks?

What's wrong with this tick-independent algorithm?
 
semiromid:
It turns out that in mql4 it's impossible to execute a cycle once every 20 seconds, regardless of the ticks?
Strictly speaking, it is not possible in the indicator. It will always depend on the arrival of ticks.
 
sergeev:

What's wrong with this tick-independent algorithm?
rlx:

But it will work if the quotes come in at least 20 seconds. Otherwise the loop will only execute when a quote arrives. For example after 34 minutes...

I described what I had during my tests this week . I just don't have the opportunity to test it yet.

I also don't know what function ---->>

MathMod

In your version .

MathMod -Functionreturns real remainder after division of two numbers.

as i understand it is....

int start()
{

int r=30;
int t=2;
int y=r/t;

Alert("Ответ = "+y); // <<<------------- вот это


return(0);

or like this

int start()
{

int r=30;
int t=2;
int y;

y=MathMod(r,t); //делим r/t

Alert("Ответ = "+y); //Остаток от двух деленных чисел

return(0);
}

while(true)
{
  if (MathMod(TimeLocal(), 20)==0) // каждая 20 секунда
  while(i<10) {   i++; } // полезный цикл
  Sleep(10); // поспим немного для разгрузки проца
}

It doesn't seem to divide anything.

 

semiromid:

It's not like there's anything to share.

I give up. I'll take it from here. won't help a lazy man like you.

 
sergeev:

I give up. I'll take it from here.


I knew it...
 
semiromid:

I knew it...
Well, how did it end?
 
AlexR:
Well, how did it end?

By the way, thank you for responding and bringing a fresh solution to this issue.
 

Thank you to everyone who helped make sense of this issue =0)

This is roughly what I wanted it to be. rlx:

bool flag = true;
int i=0;
int w=0;
int start()
{
if (flag)
{

while(i<1)

{
w=w+1;
Alert(+w, "-й, и последний звонок ^_^");
i++
;
}
flag = false;
}
return(0);
}

 
semiromid:

Thank you to everyone who helped make sense of this issue =0)

This is about what I wanted it to be. It's based on the example of rlx:

bool flag = true;
int i=0;
int w=0;
int start()
{
if (flag)
{

while(i<1)

{
w=w+1;
Alert(+w, "-й, и последний звонок ^_^");
i++
;
}
flag = false;
}
return(0);
}


Do you know a script or an Expert Advisor to make a 6-hour chart?