• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Create Custom Date Series

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

    Create Custom Date Series

    Hello,

    I have a set of 50 dates in Excel and in my strategy, I want to be able to check to see if today's date is equal to any of those 50 dates.

    I figured that I need to create a custom series in the strategy and store all the dates in that series somehow and then check against it in a loop, but I'm unsure how to do that exactly. Would anyone be able to help? Thanks in advance.

    #2
    Hello fiddich,

    A Series<T> object holds a value for every bar on the chart. Are you trying to save a value for every bar on the chart?

    Or are you trying to save a list of items which can be saved in an Array or List<T> object?

    Below is a link to the help guide on Series<T> which includes example code.
    https://ninjatrader.com/support/help...us/seriest.htm

    Also, below is a public link to a 3rd party educational site on for loops.
    https://www.dotnetperls.com/for
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      The latter, trying to save a list of items (dates) and store them in an array so I can check against them within the strategy.

      Comment


        #4
        Hello fiddich,

        Use an array (DateTime[]) or a list (List<DateTime>). These are general c# objects and are specific to NinjaScript.

        Below are public links to a 3rd party educational site on arrays and lists.
        https://www.dotnetperls.com/array
        https://www.dotnetperls.com/list
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by usero86, Today, 04:28 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by bohenriksen, Today, 04:00 AM
        0 responses
        6 views
        0 likes
        Last Post bohenriksen  
        Started by Derjan, Today, 03:09 AM
        0 responses
        7 views
        0 likes
        Last Post Derjan
        by Derjan
         
        Started by CDXTrader, Today, 12:29 AM
        0 responses
        10 views
        0 likes
        Last Post CDXTrader  
        Started by TopGun13, Yesterday, 10:35 PM
        0 responses
        7 views
        0 likes
        Last Post TopGun13  
        Working...
        X