Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DataSeries.Set not loading required values

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

    DataSeries.Set not loading required values

    Hi,

    I am trying to load a custom dataseries with a series of 'Close' values but when I debug it the values do not appear to have been loaded. I have a couple of questions about this.

    Firstly: is it ok to specify which bar's data you want to load into the series?
    By this I mean can I ask it to load the series like this:
    myDataSeries.Set(Closes[2][1])
    having set
    'private DataSeries myDataSeries;' in vars
    and
    in Initialize:
    'myDataSeries = new DataSeries(this);'

    ( where BarsArray[2] = 60min bars, strategy running on a 1min chart )

    In the help guide for NT7 it gives an example as:
    myDataSeries.Set(High - Low); ie without specifying which bars the High/Low data will be taken from (from CurrentBar always therefore).

    whereas in the NT6 help guide it gave this example:

    myDataSeries.Set(High[0] - Low[0]);

    Per my own attempt above I would like to load the previous bar's value ([2][1]) in the current bar of my series, due to the fact that I am running it in realtime and using 'FirstTickOfBar' to perform actions on the open of the next bar, thus requiring that my data comes from the prior bar ([1]).

    The second related point I would like to clarify is whether I have to use the 'myDataSeries.Set' in OnBarUpdate when BarsInProgress = 0?
    I am currently trying to update the series via .Set when BiP=2 (ie on 60min events).
    Is it ok to load via '.Set' when BiP=2? Or would that affect the way the data loads to the series? many thanks

    #2
    You spotted a bug in the helpguide, thanks - the 6.5 sample is correct - you would load double values into the DataSeries.

    If you wish to Set values tied to the primary series BIP 0 context is ok, if you'd like to have the series index tied to BIP 2 you can sync the series as needed :

    Note: In NinjaTrader 8 It is no longer needed to use an indicator to sync a secondary series. This can be done directly from the Series<T> (https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?seriest.htm) constructor. This post is left for historical purposes. Series objects are useful for

    Comment


      #3
      that's great thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      574 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      333 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      553 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      551 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X