Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 00:26:30 +0000



Post From: sc.DateTimeOut[] always returns 30.12.1899

[2018-05-09 16:20:34]
BrMa - Posts: 77
Dear ladies and gentlemen,

I'm trying to get the SCDateTime-element for a specific bar when it was finished. The documentation says (http://www.sierrachart.com/index.php?page=doc/ACS_ArraysAndLooping.html#ArrayIndexing) that
sc.DateTimeOut[]
would be the right array to look at. Unfortunately
sc.DateTimeOut[]
returns 30.12.1899 00:00:00 (which is equal to a zero-value of the variable) regardless which index I'm passing.

However - if I'm using
sc.BaseDateTimeIn[]
, it returns the right begin-SCDateTime for the bar.

Can you give me a hint what I'm doing wrong that
sc.BaseDateTimeIn[]
works and
sc.DateTimeOut[]
not, using the same index?

I'm also passing you my debug-routine to check the values - maybe it helps to determine the failure:
if (debug)
{
  char t_output[254];
  int Year, Month, Day, Hour, Minute, Second;
      
  DATETIME_TO_YMDHMS(sc.DateTimeOut[sc.IndexOfLastVisibleBar - 1], Year, Month, Day, Hour, Minute, Second);
  sprintf(t_output, "*** DateTimeOut: %d.%d.%d %d:%d:%d ***", Day, Month, Year, Hour, Minute, Second);
  sc.AddMessageToLog(t_output, 1);
  
  DATETIME_TO_YMDHMS(sc.BaseDateTimeIn[sc.IndexOfLastVisibleBar - 1], Year, Month, Day, Hour, Minute, Second);
  sprintf(t_output, "*** BaseDateTimeIn: %d.%d.%d %d:%d:%d ***", Day, Month, Year, Hour, Minute, Second);
  sc.AddMessageToLog(t_output, 1);
}