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

Proper use cases for ISeries<T> vs plain vanilla variables/objects

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

    Proper use cases for ISeries<T> vs plain vanilla variables/objects

    Hi I've been working with NinjaTrader 8 for a little while now and things are going well. However, I'm wondering about best practices in and around the subject of employing ISeries<T> objects, namely when it's recommended to use them vs a plain-vanilla variable/object. I have a crude (and possibly grossly incorrect) recollection of reading that it's better to use a Series object than a plain-vanilla variable/object whenever multi-timeframe or multi-instrument is being used because it is guaranteed to sync properly. Is this true or am I just misinformed. I've been leaning heavily on using Series objects for just about everything out of ignorance and/or concern for data/syncing-integrity, but I'm starting to have enough of them that I'm worried about how expensive they are in terms of either memory or processing. Thanks for shedding any light on this dark corner for me.

    #2
    Hello Calebg,

    Thank you for the question.

    This is really going to depend on the use case. A series is a collection of values over time, just like the bars on your chart. A Variable depends on the scope where you defined it. A variable can only hold 1 value and depending on where it was defined that may or may not persist for greater than 1 bar. If a variable is defined in the class scope, the value will persist for each bar unless you set it to something else.

    Do you need a different value on each bar, or is this something more static like a period or number that is used frequently? This will determine if a series is needed or not. If a changing value needs to be recorded for each bar, a series is likely the best choice if you need to refer back to those bars of data. If you need a value that changes but do not need to refer back to historical values, a variable will likely work for that use case.

    Multi-series scripts can introduce additional complications however the above items still apply. The use case will still determine if you need to use a series or not.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DayTradingDEMON, Today, 09:28 AM
    4 responses
    20 views
    0 likes
    Last Post DayTradingDEMON  
    Started by geddyisodin, Yesterday, 05:20 AM
    9 responses
    50 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by George21, Today, 10:07 AM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by Stanfillirenfro, Today, 07:23 AM
    9 responses
    23 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by navyguy06, Today, 09:28 AM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X