Arraylist in Ninjatrader - futures io
futures io futures trading



Arraylist in Ninjatrader


Discussion in NinjaTrader

Updated
    1. trending_up 2,144 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 2 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
 

Arraylist in Ninjatrader

(login for full post details)
  #1 (permalink)
NED
 
 
Posts: 34 since May 2010
Thanks: 7 given, 8 received

Dear all,

I've got the following problem. I have a strategy which I can test on a basket of stocks, now I want to have one equity curve therefore I want to add multiple symbols into one strategy.

I've added the symbols (SPY, DIA, SLV)and then want to work with a loop.

 
Code
                            
for (int x 0;   x++) { 

if (
Closes[x][0] > Closes[x][0
) { 
variablex Closes[x][0] } 
When using this, the different symbols will overwrite variablex. So I want to create for each symbol their own variablex.

I understand that this can be done with Arraylist.

So I add this in Variables region.
private ArrayList myArray = new ArrayList();

But how to progress further? Something like this instead of variablex?:
myArray.Add((double)(Closes[x][0]));
But then they will still write eachother over.. right?

Thanks in advance!

Reply With Quote

Can you help answer these questions
from other members on futures io?
Second Entry Indicator (Looking for testers/feedback)
NinjaTrader
Regarding Multicharts strategy trigger
MultiCharts
Help Needed: TOS Options Chain IV & IMPL MOVE Calcul …
ThinkOrSwim
Work with historical tcks data on MUltichart NET PowerLa …
MultiCharts
Indicators for pair trading MES and M2K
Platforms and Indicators
 
 
(login for full post details)
  #3 (permalink)
Market Wizard
Berlin, Europe
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,855 since Mar 2010
Thanks: 4,238 given, 26,731 received



no111 View Post
Dear all,

I've got the following problem. I have a strategy which I can test on a basket of stocks, now I want to have one equity curve therefore I want to add multiple symbols into one strategy.

I've added the symbols (SPY, DIA, SLV)and then want to work with a loop.

 
Code
                            
for (int x 0;   x++) { 
if (
Closes[x][0] > Closes[x][0
) { 
variablex Closes[x][0] } 
When using this, the different symbols will overwrite variablex. So I want to create for each symbol their own variablex.

I understand that this can be done with Arraylist.

So I add this in Variables region.
private ArrayList myArray = new ArrayList();

But how to progress further? Something like this instead of variablex?:
myArray.Add((double)(Closes[x][0]));
But then they will still write eachother over.. right?

Thanks in advance!

If I understand correctly, you will only have a limited know number of values for x. In that case a fixed array is more appropriate then an array list of variable dimension.

 
Code
private double[]  variablex = new double [3];


should do the trick. You can then use it as

 
Code
variablex[0] = Closes[0][0];
variablex[1] = Closes[1][0];


etc.

Reply With Quote
The following user says Thank You to Fat Tails for this post:


futures io Trading Community Platforms and Indicators NinjaTrader > Arraylist in Ninjatrader


Last Updated on July 16, 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