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!
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
NinjaTrader
Proper use cases for ISeries<T> vs plain vanilla variables/objects
Collapse
X
-
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.Tags: None
-
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
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Aviram Y, Today, 05:29 AM
|
0 responses
2 views
0 likes
|
Last Post
by Aviram Y
Today, 05:29 AM
|
||
Started by quantismo, 04-17-2024, 05:13 PM
|
3 responses
25 views
0 likes
|
Last Post Today, 05:23 AM | ||
Started by ScottWalsh, 04-16-2024, 04:29 PM
|
7 responses
34 views
0 likes
|
Last Post Today, 05:15 AM | ||
Started by cls71, Today, 04:45 AM
|
0 responses
6 views
0 likes
|
Last Post
by cls71
Today, 04:45 AM
|
||
Started by mjairg, 07-20-2023, 11:57 PM
|
3 responses
218 views
1 like
|
Last Post
by PaulMohn
Today, 04:22 AM
|
Comment