Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Regarding DataSeries

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

    Regarding DataSeries

    if i use Value.Set to add a value to the dataseries, not on every candle, but only occasionally

    - for the purpose of this thread, lets say whenever 2 MAs cross -

    what happens with the DataSeries when Value.Set isnt called. will it be 0, will it be equal to the previous candle or just nothing or what? further: Value[1] will still refer to the previous bar or to the last time the value was set?

    example

    if(emaSeries[1]>smaSeries[1] && emaSeries[0]<smaSeries[0])
    Value.Set(50);


    assuming onbarupdate is called while the condition is false what will the value output be? and how does the timestamp [] work for this or later bars?


    cant test this out myself right now, so i hope someone can enlighten me
    thanks

    #2
    Hello BigRo,

    Thank you for writing in. In the case of Plots, if you do not plot a value for every bar, the plot will not visually display. Whenever you do not set a value for a bar in a data series, a placeholder value is used behind the scenes. For more information, please see our help guide under "Checking For Valid Values" here: http://ninjatrader.com/support/helpG...ghlightsub=set

    Checking for Valid Values
    It is possible that you may use a DataSeries object but decide not to set a value for a specific bar. However, you should not try to access a DataSeries value that has not been set. Internally, a dummy value does exists, but you want to check to see if it was a valid value that you set before trying to access it for use in your calculations.

    DataSeries.ContainsValue(int barsAgo)
    Returns a true or false value.
    Please let me know if I may be of further assistance.
    Michael M.NinjaTrader Quality Assurance

    Comment


      #3
      ok thanks. but Value[1] would still refer to the placeholder value of the previous bar, if i didnt set the value for the previous bar?

      Comment


        #4
        Hello BigRo,

        That is correct.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        633 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        567 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X