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 AttiM, 02-14-2024, 05:20 PM
    12 responses
    213 views
    0 likes
    Last Post DrakeiJosh  
    Started by cre8able, 02-11-2023, 05:43 PM
    3 responses
    238 views
    0 likes
    Last Post rhubear
    by rhubear
     
    Started by frslvr, 04-11-2024, 07:26 AM
    8 responses
    117 views
    1 like
    Last Post NinjaTrader_BrandonH  
    Started by stafe, 04-15-2024, 08:34 PM
    10 responses
    47 views
    0 likes
    Last Post stafe
    by stafe
     
    Started by rocketman7, Today, 09:41 AM
    3 responses
    12 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X