Problem with embeded minute minute funtion => Minute() always return the same value

 

Hello @ all,

Below is my simple void function that should return the minute value but it don't work.
The first return minute is good but:  1, 2, 3, 4 or 5 minutes later (and so on) the returned value is always the same...
Is there a cache to reset or something else to do ?

Help would be appreciated.
Thank.

void HandleTIME(){
Sleep(10000);

Print (" i come here");

int minute = Minute();

Print (minute, " : is lastminute");
}
 
breizhforex:

Hello @ all,

Below is my simple void function that should return the minute value but it don't work.

Functions of type  void  do not return anything . . .  
 
breizhforex:

Hello @ all,

Below is my simple void function that should return the minute value but it don't work.
The first return minute is good but:  1, 2, 3, 4 or 5 minutes later (and so on) the returned value is always the same...
Is there a cache to reset or something else to do ?

If you are running this in the Strategy Tester you should be aware that the Sleep()  doesn't actually do anything useful in the Strategy Tester.  Testing Features and Limits in MetaTrader 4

"Some functions are processed/passed without output
These are Sleep(), Alert(), SendMail(), PlaySound(), MessageBox(), WindowFind(), WindowHandle(), WindowIsVisible()"
 
RaptorUK:
Functions of type  void  do not return anything . . .  


Hello RaptorkUK:

Thank for answering.

Yes i know that void does not return anything, but if you watch my simple code, you can see that i have a print in my void function to survey the minute evolution.
And never it change... why ?

Once thank.
 
i am not using tester, this simple code is on a live chart and called from a main start() function.
 
breizhforex:
i am not using tester, this simple code is on a live chart and called from a main start() function.
Does the start() function have an infinite loop ?  or is start() called for each new tick ?
 
void start() { 
   bool LoopFlag = true;
   while (LoopFlag == true) {
   HandleTIME();
   Sleep(500);
   }
}
above is the start function
 
What your suggest to make it working ?
 
breizhforex:
above is the start function
So you have an infinite loop . . . have you read the Documentation on Minute() ?  you should . . .  

I suspect that the Server time isn't being updated as you are doing everything after receiving one tick . . .  you could try a RefreshRates()  after your Sleep()  in your HandleTIME()  function.
 
trying now
 
great :) :) :) with the RefreshRates() function, minute returned is good good good.
Reason: