Different time frames - different close values?

 

Hi there,

 I would like to ask why Close values are not same for different time frames. I have bars from PERIOD_M1 and PERIOD_M5 with same datetime but with different Close values.

Example:

2015.03.03 17:34:01.437 USDCAD,M5: 2015.03.03 17:40:00 | 2015.03.03 17:40:00        1.24416 | 1.2443
2015.03.03 17:34:01.436 USDCAD,M5: 2015.03.03 17:40:00 | 2015.03.03 17:40:00        0.75609 | 0.7562

 

Code: 

 

datetime time = iTime(symbol,PERIOD_M5, 10);
int shift = iBarShift(symbol, PERIOD_M1, time);
   
Print(time, " | ",  iTime(symbol, PERIOD_M1, shift), "        ", iClose(symbol, PERIOD_M5, 10), " | ", iClose(symbol, PERIOD_M1, iBarShift(symbol, PERIOD_M1, time)));
  

 

How is it possible that they are different? Many thanks for reply!

 
Because the 17:40 M1 bar closes at 17:41 and the 17:40 M5 bar closes at 17:45
 
GumRai:
Because the 17:40 M1 bar closes at 17:41 and the 17:40 M5 bar closes at 17:45
Thank you for good idea GumRai!
Reason: