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 Hwop38, 05-04-2026, 07:02 PM
|
0 responses
152 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
305 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
244 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
345 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
176 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment