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

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
    BertrandNinjaTrader Customer Service

    Comment


      #3
      that's great thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Davidtowleii, Today, 12:15 AM
      0 responses
      3 views
      0 likes
      Last Post Davidtowleii  
      Started by guillembm, Yesterday, 11:25 AM
      2 responses
      9 views
      0 likes
      Last Post guillembm  
      Started by junkone, 04-21-2024, 07:17 AM
      9 responses
      68 views
      0 likes
      Last Post jeronymite  
      Started by trilliantrader, 04-18-2024, 08:16 AM
      4 responses
      22 views
      0 likes
      Last Post trilliantrader  
      Started by mgco4you, Yesterday, 09:46 PM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Working...
      X