hey gentlemen, trying to program dynamically my program to know without my input on whether the current week due to holidays will end on a Thursday or any day of the week other than the norm?
Assuming you mean the USA, and you are referring to holidays when the stock market is closed, New Year's Day, Independence Day, and Christmas Day are the only holidays that can fall on a Friday. So you can simply hard code those days. Remember though, that if those holidays fall on a Saturday, they are usually celebrated on the previous Friday. What makes you assume that only gentlemen are on EliteTrader?
Create and manually maintian a holiday calendar (e.g., take data from http://www.market-holidays.com), and have your software check if a day is a holiday or not. For example, pseudocode: Code: function addToDate (Date startingDay, signed integer daysToAdd) begin signed integer singleDayChange; if daysToAdd > 0 then singleDayChange = 1 else singleDayChange = -1 end if Date finalDay = startingDay signed integer daysLeft = daysToAdd while daysLeft != 0 do loop forever finalDay = finalDay + singleDayChange * OneDay if finalDay is not in holiday_calendar and not a Satuday and not a Sunday then break loop end if end loop daysLeft = daysLeft - singleDayChange end loop return finalDay end function Then you can call addToDate (aSunday, 5). If the returned trading day is not Friday, that week has a holiday. One additional holday for U.S. stock markets is Good Friday.
I was hoping that it would be built in thinkorSwim, because your point is valid. A holiday for my futures contract could differ from my options contract and it can differ from a stock market contract. So if I have multiple contacts open, I would not like to hard code each individual chart of different contracts plus checking calendars all summing up to my money being in jeopardy. Appreciate your insight, but would happy to be able to do the latter.
Use a library to do it properly. Coding it manually is far from easy and typically inconsistent. For python, pandas market calendars is good.