Download MetaTrader 5
To add comments, please log in or register
Register at MQL5.community and leave your comments!
Michal Jurnik
5491
Michal Jurnik 2015.03.03 16:41 

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!

Keith Watford
Moderator
7887
Keith Watford 2015.03.03 17:17  
Because the 17:40 M1 bar closes at 17:41 and the 17:40 M5 bar closes at 17:45
Michal Jurnik
5491
Michal Jurnik 2015.03.03 17:40  
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!
/
To add comments, please log in or register