DayofWeek seems less than ideal to me as it doesn't account for holidays or unexpected market closures nor time zone differences. Any tips?
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Testing for first bar of the week
Collapse
X
-
Hello Sparkyboy,
That would be difficult without making logic that reads the holiday dates ahead of time and then uses that information to change your first day of week logic depending on the week. There is no data on holiday days so there is not a way to compare if a day is a holiday because nothing happened. That day is just skipped in processing. To know that the bar following that was the first day of the week and not the holiday would involve comparing an already known holiday date and checking if the current day is 1 day after that holiday date. If so that would be the first bar of the week.
One possible way to do this would be to use a fixed start day like monday and then also use the trading hours template to get the holidays. If we assume monday was a holiday and you are now processing the first bar of the tuesday session you could compare if the current date minus one day matches any of the holiday dates, if so that could toggle the logic to use today as the first bar of the week.
Here are some links to finding trading hours/holidays and also session information.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
557 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
324 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
101 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
545 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
547 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment