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 aussugardefender, Today, 01:07 AM
        0 responses
        1 view
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        238 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        383 views
        1 like
        Last Post Gavini
        by Gavini
         
        Started by oviejo, Today, 12:28 AM
        0 responses
        1 view
        0 likes
        Last Post oviejo
        by oviejo
         
        Started by pechtri, 06-22-2023, 02:31 AM
        10 responses
        125 views
        0 likes
        Last Post Leeroy_Jenkins  
        Working...
        X