Login Page - Create Account

Support Board


Date/Time: Sat, 05 Jul 2025 04:40:38 +0000



Post From: ACSIL: skip a holiday

[2016-05-20 20:08:46]
SSS - Posts: 16
Hi.

I'm running the following code to build an array of valid trading days (with the ultimate purpose of drawing lines on them). I've managed to exclude Saturdays and Sundays, but how do I check if a given date is a holiday? For instance no volume occured, or the high could not be obtained.


SCDateTime firstDate = YMD(2016, 5, 9);

  SCDateTime Days[9]; //declare an array of datetimes

  Days[0] = firstDate; //assign first array element the value of firstDate

  for (int n=1; n<9; n++)
  {
   SCDateTime newDay = Days[n-1] + 1*DAYS; //add one day to the first date
   if (newDay.GetDayOfWeek() == SATURDAY) newDay = newDay + 1*DAYS; //if it's a Saturday, add another day
    if (newDay.GetDayOfWeek() == SUNDAY) newDay = newDay + 1*DAYS; //if it becomes a Sunday after addition, add one more day

    if (???date is a holiday???) newDay = newDay + 1*DAYS; //how do I check if it's a holiday. How to obtain volume at the date of newDay?
    
    Days[n] = newDay;
  }

I appreciate if you can point me in the right direction. Thanks in advance.