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!
See more
See less

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 dward123, 01-02-2024, 09:59 PM
    3 responses
    159 views
    0 likes
    Last Post bjunaid
    by bjunaid
     
    Started by ETFVoyageur, Today, 04:00 PM
    1 response
    7 views
    0 likes
    Last Post ETFVoyageur  
    Started by AaronKTradingForum, Today, 03:44 PM
    1 response
    8 views
    0 likes
    Last Post AaronKTradingForum  
    Started by Felix Reichert, 04-26-2024, 02:12 PM
    11 responses
    77 views
    0 likes
    Last Post Felix Reichert  
    Started by junkone, 04-28-2024, 02:19 PM
    7 responses
    83 views
    1 like
    Last Post junkone
    by junkone
     
    Working...
    X