Login Page - Create Account

Support Board


Date/Time: Wed, 02 Jul 2025 10:51:10 +0000



[Programming Help] - ACSIL: skip a holiday

View Count: 1836

[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.
[2016-05-20 20:18:45]
Cavalry3162 - Posts: 523
maybe use an online service like http://www.bank-holidays.com/index.htm ?

there might be some free services out there too.
[2016-05-20 20:22:43]
SSS - Posts: 16
Thanks for the tip, Andreas. The problem is getting this to work for different symbols.

I thought I might check sc.High[newDate]. If it returns zero (or an error), then I'll add a day.
The problem is sc.High expects a bar index as its argument. I can't seem to find a way to determine the bar index of a given date.
[2016-05-20 20:26:40]
Cavalry3162 - Posts: 523
yeah, different countries bring in some complexity..

no data might work, but isnt 100% as there are some "half trading day" holidays in the US or on some holidays GLOBEX session is open but cash markets are closed.

maybe you build a database per exchange and check against it?
[2016-05-21 00:50:24]
Sierra Chart Engineering - Posts: 104368
Not having sufficient Intraday data for a particular day or no intraday data for a particular Weekday would be a good way to check for this. You could use this function:
http://www.sierrachart.com/index.php?page=doc/doc_ACSIL_Members_Functions.html#scCalculateTimeSpanAcrossChartBars
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account