Login Page - Create Account

Support Board


Date/Time: Sun, 08 Sep 2024 02:06:51 +0000



[Programming Help] - How to access data of last trading day?

View Count: 145

[2024-07-15 14:53:00]
User538264 - Posts: 26
I am using ASCIL programming to access bar wise data, I have to work with High and Low of the previous session, I can get the bar using the time and index of the bar using the time, but the problem arrives on Monday, that is I want to access the data of the last trading session which I can do by subtracting a day from the current date, but if it's monday then I have to subtract 3 days, even that works for me, but what about holidays? is there something by which I can get the date of the last trading session? like if Friday is Holiday and today is monday, and I want to get the data on 60 mins candles for the last trading session that would be thursday, so which is 4 days behind from monday, and it falls in the exception of subtracting 1 and 3 from the current date. So is there a function or way to get last trading days data, without opening two different charts that is daily and intraday
[2024-07-18 18:48:02]
ForgivingComputers.com - Posts: 928
You can use Working with the SCDateTime Variables and Values: GetDayOfWeek() and on Monday go back day by day until you get to Friday.

For holidays, this has been known to work: sc.CalculateTimeSpanAcrossChartBars()

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

Login

Login Page - Create Account