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

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 jclose, Today, 09:37 PM
        0 responses
        5 views
        0 likes
        Last Post jclose
        by jclose
         
        Started by WeyldFalcon, 08-07-2020, 06:13 AM
        10 responses
        1,414 views
        0 likes
        Last Post Traderontheroad  
        Started by firefoxforum12, Today, 08:53 PM
        0 responses
        11 views
        0 likes
        Last Post firefoxforum12  
        Started by stafe, Today, 08:34 PM
        0 responses
        11 views
        0 likes
        Last Post stafe
        by stafe
         
        Started by sastrades, 01-31-2024, 10:19 PM
        11 responses
        169 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X