knili:
Does anyone knows why this
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
KamHi 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.
Thanks for the info. I'm clear on that now
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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