Download MetaTrader 5

Strange Time Problem

To add comments, please log in or register
Frank Holland
11
Frank Holland  

I'm using build 646 v4.00.

Alert("TimeHour(TimeCurrent()) = ", TimeHour(TimeCurrent()));  //works 

Alert("TimeMinute(Time[i]) = ", TimeMinute(Time[10]));  //works, alert displays minute value 10 mins ago

Alert("TimeHour(Time[i]) = ",     TimeHour(Time[4])); //Doesn't work, alert displays current hour value


Any ideas anybody?

whroeder1
15572
whroeder1  
WoodenHorse:
Alert("TimeMinute(Time[i]) = ", TimeMinute(Time[10]));  //works, alert displays minute value 10 mins ago
Alert("TimeHour(Time[i]) = ",     TimeHour(Time[4])); //Doesn't work, alert displays current hour value
Time[10]  is not 10 minutes ago, it is 10 bars ago. On a D1 chart that is 10 trading days ago.
On H1 or higher charts, TimeMinute(Time[x]) will always be zero. On M5 chart it will always be a multiple of 5.
Only on the M1 chart will Time[10] be approximately 10 minutes ago.
Frank Holland
11
Frank Holland  

Many thanks for your quick, detailed & easy to follow response.

Alas, I think I was having a bit of a senior moment!

Cheers.

To add comments, please log in or register