[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 450

 
sammi61:
Can you suggest a script or an Expert Advisor to make a 6-hour chart?
There is such an innovative thing as forum search. Try it, you will be pleasantly surprised.
 
granit77:
There is such an innovative thing as a forum search. Try it, you'll be pleasantly surprised.
Apparently, there's a lot of nanotechnology involved?
 
semiromid:

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);
}

bool flag=true;

int start()

{

if(flag) {

Alert("once");

flag=false;

}

return(0);

}

 
semiromid:

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

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

If you come across something new, look at the help. It's not hard to use the help. Why force others to write what's already been written before? Mm-hmm?
 
semiromid:
So it turns out that in mql4 it's impossible to execute a cycle once every 20 seconds, regardless of the ticks?


This is not a problem of mql4. This is a forex problem.

PS If prices have not changed over the last 20 seconds, what should we calculate?

 
sammi61:

Do you know a script or an Expert Advisor to make a 6-hour chart?
MT4 comes with a period converter script. But if you don't need the chart itself, you can use this library.
 
peshihod:
If you come across something new -- see help. It's not hard to use help. Why do you force others to write what has already been written before? Uh-huh?


Wait... I've looked at the help beforehand and described the examples .

The MathMod function calculates the real remainder f of x / y such that x = i * y + f , where i is an integer, f has the same sign as x, and the absolute value of f is less than the absolute value of y.

Parameters:

value . - Value of the divisor.
value2 - Value of the divisor.

Example:
  double x=-10.0,y=3.0,z; z=MathMod(x,y); Print("The remainder of ",x," / ",y," is ",z); // Output: The remainder of -10 / 3 is -1

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I don't understand this ------>>>

What does this MathMod function have to do with it?

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

.

 


while(true)
{
if (MathMod(TimeLocal(), 20)==0) // every 20 seconds
while(i<10) { i++; } // useful loop
Sleep(10); // take a short nap to unload the processor
}

This procedure will check every 10 milliseconds --- whether the real remainder from dividing TimeLocal() by 20 = zero.

That's if you want nano precision regardless of computational cost. ;)

 
semiromid:

I don't understand this ------>>>

What does this MathMod function have to do with it?

MathMod() is division. The rest is pure mathematics: if we divide result from TimeLocal() 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.

 

Good afternoon.

Who can tell me how to normalize a number like this?

I.e. we need this function F(8,5464.00) = 85464.00

Thank you.

Reason: