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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    81 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    41 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    66 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X