Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Proper AddDataSeries syntax for Day and Week

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

    Proper AddDataSeries syntax for Day and Week

    Hello!

    What is the appropriate way to add the data series for the day and week bars.

    I have successfully added the 15 minute, 30 minute, and 2 hour bars using the following format in State == State.Configure:

    AddDataSeries(null, BarsPeriodType.Minute, 15);
    AddDataSeries(null, BarsPeriodType.Minute, 30);
    AddDataSeries(null, BarsPeriodType.Minute, 120);

    But when I try to add the day and week bars using the same format:

    AddDataSeries(null, BarsPeriodType.Day, 1);
    AddDataSeries(null, BarsPeriodType.Week,1);

    It doesn't load anything and actually prevents the rest of my bars from loading.

    Thank you for your help.

    #2
    Hello benjamin$,

    Thanks for your post.

    The second sample code set in the AddDataSeries() help guide page demonstrates adding a secondary Day series to the script. The same would need to be done for adding a secondary Week series.

    From the help guide: AddDataSeries(BarsPeriodType.Day, 1);

    Something you could do is open a New > Strategy Builder window, navigate to the Additional Data section of the Builder, add a secondary Day and Week series, then click the 'View code' button to see the generated syntax.

    Note that secondary bars series added to a script would not appear on a chart when the strategy is enabled. These are simply used for calculations in the script.

    See this help guide page for more information about AddDataSeries() and sample code: https://ninjatrader.com/support/help...dataseries.htm

    See this help guide page for detailed information about working with Multi-Timeframe/Instrument NinjaScripts: https://ninjatrader.com/support/help...nstruments.htm

    And, see this help guide page for information about adding secondary series in the Strategy Builder: https://ninjatrader.com/support/help...onalDataScreen

    Let us know if we may assist further.
    Last edited by NinjaTrader_BrandonH; 05-31-2022, 07:54 AM.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    639 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    572 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X