Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Identify last trading day of the week
Collapse
X
-
Identify last trading day of the week
Is there any function to identify last trading day of the week? I need it when week is short due to holidays, so the last trading day is Thursday.Tags: None
-
Hello nysetrader,
Thanks for your post and I am happy to assist you.
There are no functions to determine the last trading week, but to know the day of the week you can use the DayOfWeek enum:
Please let me know if I can assist you any further.Code:if (Time[0].DayOfWeek = DayOfWeek.Thursday) { // do something }JoydeepNinjaTrader Customer Service
-
Thank you.
I know how to know the day of week, but I need to know if it last trading day of the week or not.
Comment
-
Hello nysetrader,
Unfortunately there are no native functions for it. You can however hard code the specific days and compare it. Say if 18th and 26th are the date you are looking for then hard code the date in an array and look if the bar date matches it or not
in variable:
in OnBarUpdateCode:DateTime[] holidays = {new DateTime(2012,4,18), new DateTime(2012, 4, 26)};
Code:if (Time[0].Date == holidays[0] || Time[0].Date == holidays[1]) { // do something }
Please let me know if I can assist you any further.JoydeepNinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
67 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
36 views
0 likes
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
60 views
1 like
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|
||
|
Started by CarlTrading, 03-30-2026, 11:51 AM
|
0 responses
62 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:51 AM
|
||
|
Started by CarlTrading, 03-30-2026, 11:48 AM
|
0 responses
53 views
0 likes
|
Last Post
by CarlTrading
03-30-2026, 11:48 AM
|

Comment