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 kinfxhk, 07-14-2026, 09:39 AM
        0 responses
        127 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 10:18 AM
        0 responses
        105 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 09:50 AM
        0 responses
        85 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 07:21 AM
        0 responses
        105 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-11-2026, 02:11 AM
        0 responses
        86 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X