Setting multiple dataseries using a for loop - futures io
futures io futures trading



Setting multiple dataseries using a for loop


Discussion in NinjaTrader

Updated
    1. trending_up 1,132 views
    2. thumb_up 3 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Setting multiple dataseries using a for loop

(login for full post details)
  #1 (permalink)
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
 
Xav1029's Avatar
 
Posts: 1,375 since Dec 2011
Thanks: 1,452 given, 3,369 received

I was wondering if it is possible to set a large amount of dataseries using a for loop. For example, say I have 64 dataseries named myDataSeries0, myDataSeries1,....myDataSeries63. Is it possible to pass i into into a structure to set all of these in the same loop?

Something similar to this, but that works

for(int i=0;i<64;i++)
{
myDataSeries+i.Set(myArray[i]);
}

Visit my futures io Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
MACD line not plotting after change of plot order
NinjaTrader
Short Interest Ratio indicator?
ThinkOrSwim
Can the Magnet Tool Affect Chart Orders In Overcharts Ha …
Platforms and Indicators
If ES tracks SPX, why do support/resistance, Level 2, vo …
Emini and Emicro Index
SimplerOptions
Trading Reviews and Vendors
 
 
(login for full post details)
  #3 (permalink)
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 320 given, 620 received


You can use Dictionary for that:

 
Code
                            
private Dictionary<intDataSeriesd//in Variables section
= new Dictionary<intDataSeries>();    //in initialize
for (int i 0dsCounti++) //wherever
{
    
d[i] = new DataSeries(this);
}

//to set the values
for (int i 0dsCounti++)
{
    
d[i][0] = 343453.44 //setting data series d[i] value for current bar
}
//to access the values
for (int i 0dsCounti++)
{
    Print(
"Value of the data series: "d[i][0]); //getting data series d[i] value for current bar


Reply With Quote
The following 3 users say Thank You to gregid for this post:
 
(login for full post details)
  #4 (permalink)
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
 
Xav1029's Avatar
 
Posts: 1,375 since Dec 2011
Thanks: 1,452 given, 3,369 received

Thanks @gregid. I will try it when I get home. This should take 2000+ lines of code and trim it down to 400-500

Visit my futures io Trade Journal Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Setting multiple dataseries using a for loop


Last Updated on August 28, 2012


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts