NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 06-14-2012, 02:15 AM   #1
sercava
Member
 
Join Date: Nov 2011
Posts: 55
Thanks: 18
Thanked 3 times in 3 posts
Default Declaring a List

I thought declaring a list is like this:

Code:
List<double> s = new List<double>();
But I got:

Code:
The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)
Is my first attempt with lists. Any tip or general information about them? I've been here

Thanks in advance,

Sergio
sercava is offline  
Reply With Quote
Old 06-14-2012, 02:24 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
Default

Hi Sergio, it looks like you have not added using System.Collections; to your script's declaration section?
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 06-14-2012, 02:26 AM   #3
sercava
Member
 
Join Date: Nov 2011
Posts: 55
Thanks: 18
Thanked 3 times in 3 posts
Default

How can I do that?
sercava is offline  
Reply With Quote
Old 06-14-2012, 02:30 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
Default

In your script directly, go to the top section called 'Using Declarations', expand it and add

Code:
using System.Collections;
Then compile again, it should take it now...
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 06-14-2012, 02:32 AM   #5
sercava
Member
 
Join Date: Nov 2011
Posts: 55
Thanks: 18
Thanked 3 times in 3 posts
Default

Didn't work. Same error.

EDIT:With

Code:
System.Collections.Generic;
compiles
sercava is offline  
Reply With Quote
Old 06-14-2012, 02:38 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,404
Thanks: 252
Thanked 974 times in 957 posts
Default

My bad, you're right for the List it needs System.Collections.Generic, for ArrayList the System.Collections

Glad it compiles now.
NinjaTrader_Bertrand is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Bertrand for this post:
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Declaring a Color in Variables Stopped General Programming 2 05-11-2012 12:13 PM
Declaring and Setting a Public Variable DenMan Indicator Development 6 10-14-2011 08:33 AM
NT crashes when importing symbol list when symbols already exist in the list cunparis Miscellaneous Support 5 03-21-2009 04:09 AM
Declaring a default constructor gives NT the hiccups jbeninga Strategy Development 6 04-08-2008 01:25 AM
If NT crashes after importing symbol list, list is not saved Pete S Historical NinjaTrader 6.5 Beta Threads 4 03-16-2008 06:10 AM


All times are GMT -6. The time now is 01:20 AM.