View Single Post
  #2 (permalink)  
Old 09-18-2006, 04:27 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 986
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Smile

Quote:
Originally Posted by knili
Does anyone knows why this
Alert (TimeToStr(Time[2300], TIME_DATE));
Displays the date as 1970.01.01
while this
Alert (TimeToStr(Time[2299], TIME_DATE));
Displays the date as 2006.09.05

Thanks
Kam
Hi Kam!

You are very lucky that the Time[] function of the bar 2299 returned 2006.09.05. which means you have up-to 2300 bars on your chart (I'm kidding)!

The Time[] function returns the open time of the given bar!
The reason you've got 1970.01.01 for the bar 2300 is that you don't have 2300 bar on your chart and the Time[2300] have to return -1.
But the TimeToStr() function when saw -1 it returned the default date 1970.01.01.
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Reply With Quote