Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Specific Day of Week

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Specific Day of Week

    For backtesting a strategy, I'm only interested in the last day of the week.

    Right now, I can specify <do something> on Friday by
    if (Time[0].DayOfWeek == DayOfWeek.Friday)
    <do something>

    But sometimes, there are holidays on a Friday and I miss out using this method. Is there a better way? Would there be a way that would work with last day of a month too?

    #2
    pretender,

    You can work with DateTimes here and manipulate them for your calculations, however to keep track of holidays you may need to use your own pre-set holidays so the strategy knows what these days are.

    Represents an instant in time, typically expressed as a date and time of day.


    I seem to remember some posts the the forum related to including holidays, I would suggest browsing a little to find them.

    Here is an example : http://www.ninjatrader.com/support/f...ad.php?t=24947
    Adam P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    152 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    87 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    131 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    127 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    106 views
    0 likes
    Last Post CarlTrading  
    Working...
    X