What I want to do is read into the array five different moving averages, etc. and their different types. Example 20 SMA, LinReg 9 and so on. This requires 2D array which holds the string "Type" and double "Value". I then want to sort them from the lowest to highest for further processing. My question is what is the easiest way to do this? Could I use the List method or would I need to use the Sort().
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
Array with string and double for sorting
Collapse
X
-
Array with string and double for sorting
I am new at NT programming, so this is fairly basic.
What I want to do is read into the array five different moving averages, etc. and their different types. Example 20 SMA, LinReg 9 and so on. This requires 2D array which holds the string "Type" and double "Value". I then want to sort them from the lowest to highest for further processing. My question is what is the easiest way to do this? Could I use the List method or would I need to use the Sort(). -
JoydeepNinjaTrader Customer Service
-
Originally posted by profitsareking View PostI am new at NT programming, so this is fairly basic.
What I want to do is read into the array five different moving averages, etc. and their different types. Example 20 SMA, LinReg 9 and so on. This requires 2D array which holds the string "Type" and double "Value". I then want to sort them from the lowest to highest for further processing. My question is what is the easiest way to do this? Could I use the List method or would I need to use the Sort().
ref: http://msdn.microsoft.com/en-us/library/f7fta44c.aspxLast edited by koganam; 01-16-2013, 05:02 PM.
Comment
-
Hi and thanks to both NinjaTrader_Joydeep and koganam.
I decided to use SortedList since SortedDisctionary requires all unique keys else throws an exception. Since, in a rare case, two moving averages could have the same value when crossing, this would require exception handling which complicates things.
I decided to use the sample at http://msdn.microsoft.com/en-us/library/cxb97few.aspx
I am getting compile error:
The type or namespace name 'SortedList' could not be found (are you missing a using directive or an assembly reference?)
Can you give me quick heads up what is that about? Many thanks
Comment
-
I still get the same error and in addition I get:
Using the generic type 'System.Collections.Generic.SortedList<TKey,TValue >' requires '2' type arguments
Comment
-
Hello profitsa,reking
To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com
Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.
I look forward to assisting you further.
*The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.JoydeepNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,404 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
||
Started by Shai Samuel, 07-02-2022, 02:46 PM
|
4 responses
95 views
0 likes
|
Last Post
by Bidder
Today, 12:11 AM
|
||
Started by DJ888, Yesterday, 10:57 PM
|
0 responses
7 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
159 views
0 likes
|
Last Post Yesterday, 10:23 PM | ||
Started by Belfortbucks, Yesterday, 09:29 PM
|
0 responses
8 views
0 likes
|
Last Post
by Belfortbucks
Yesterday, 09:29 PM
|
Comment