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
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
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.
JesseNinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Carolscogginsi, Today, 10:45 PM
|
0 responses
5 views
0 likes
|
Last Post Today, 10:45 PM | ||
Started by RaddiFX, Today, 10:15 AM
|
2 responses
14 views
0 likes
|
Last Post
by RaddiFX
Today, 09:33 PM
|
||
Started by patrickmlee007, Today, 09:33 AM
|
2 responses
18 views
0 likes
|
Last Post Today, 08:56 PM | ||
Started by magnatauren, 08-15-2020, 02:12 PM
|
5 responses
206 views
0 likes
|
Last Post
by RaddiFX
Today, 08:46 PM
|
||
Started by rene69851, 05-02-2024, 03:25 PM
|
1 response
23 views
0 likes
|
Last Post
by rene69851
Today, 08:20 PM
|
Comment