Print out a created list
Author: techtrader007
Creation Date: 12/27/2010 1:52 PM
profile picture

techtrader007

#1
How can I print out a sorted list to see which is in a list, like the rotational scripts.
Thanks.
profile picture

Eugene

#2
Generally, you can use PrintDebug or PrintStatusBar (may slow processing down).
profile picture

techtrader007

#3
thanks this doesn´t help.
for example in this script Weak-stock Rotation how can I controll and see which symbol is in
list.Sort(this); if I set PrintDebug (bar) I get only figures.

profile picture

Cone

#4
What kind of a list is it? What's in it?
profile picture

techtrader007

#5
for example you sort the rsi in the weak stock so I would like to see
first the last symbols with the rsi in the sorted list and add some for example
volume or close to this list.
profile picture

Eugene

#6
Have you already checked the QuickRef for FirstActualBar and SetContext? They do what you request: print out a SortedList.
profile picture

techtrader007

#7
thanks this examples helps, but to know where it is takes time.
Thanks
profile picture

techtrader007

#8
Sorry, but I still hvae problems to bring the RSI in a list. It begins not at the first symbol.

CODE:
Please log in to see this code.
profile picture

Eugene

#9
1. The way RSISeries is defined, it will always be fixed to the first (clicked) symbol. Moved the definition of the DataSeries to the DataSetSymbols loop.
2. list.Add( ds,RSISeries[ds] ) --> what this call does is to add the ds-th bar of the static RSISeries to the list. I think it wasn't your original intention.
CODE:
Please log in to see this code.
profile picture

techtrader007

#10
and last question, where do have to set the sorting features:
list.Sort(this);
I get the alert I have no defintion for sort.
profile picture

Eugene

#11
In Google, or MSDN, Dotnetperls, etc., in C# books.
profile picture

Cone

#12
Eugene, the SortedList example isn't helping here because he's not using one in the RSI rotation script.

tt, the definitions are these elements:
CODE:
Please log in to see this code.
I don't think I can adequately explain (in an understandable way) how IComparer works to sort a generic list, but the "this" in ".Sort(this)" is a reference to the IComparer<RSIHolder>-derived WealthScript class.
profile picture

techtrader007

#13
ok. I don´t bother you, but I mean I get an error message if I set this list.Sort()
in your recommended script.
I would like to sort this. The defintion you know and I am learning. Do you think everyone is buying WL6 and is a specialist in C++
CODE:
Please log in to see this code.


profile picture

Eugene

#14
SortedList, if you're asking about this Collection specifically, is called SortedList because it's already sorted and don't have to be sorted explicitly.
profile picture

Cone

#15
Well, maybe he is using the SortedList after all, but that's not what the RSI Rotation Script uses. But if you insist on using the SortedList, it sorts on the Key as you add items to the list. The ".Sort" method does not exist. See for yourself here: http://msdn.microsoft.com/en/library/ms132319.aspx

Rearranging things for your example:

CODE:
Please log in to see this code.
profile picture

techtrader007

#16
thanks Cone. I think I have to read and read. It is now decending sort
To understand this completly which item do I have to change for acending sort here!

I find the to cut off some symbols interesting as well, but to integrate this as well
it is to much for me at the moment.

for(int i = 1; i <= c - 10; i++)
list.RemoveAt(0);

For suggestion to list features of all list definitions would be helpful. I know C++ books.
But trading script examples with list functions would help very much.
profile picture

Eugene

#17
Did you mean to say "for descending sort here"? SortedList = ascending sort order, not descending.

Because SortedList doesn't have a Reverse/Sort method, changing its order would require some extra steps. However, you can change the order by simply looping over its elements:
CODE:
Please log in to see this code.

Here it's being sorted in descending order; replace the line that does the looping with the commented out line above to change back to ascending sort order.
profile picture

techtrader007

#18
perfect.Sorry you ve right acending. I have to ask again, I would like to learn all
this .Getkey list.GetbyIndex(i) and and in the tutorial I don´t find so I have to go to
http://msdn.microsoft.com/en/library/ms132319.aspx is this the right place where I find all this stuff or I am reading now the recommended c++ books. This functions I think will come later, because I am reading now 3 third capital.


profile picture

Eugene

#19
Yes, MSDN is the place to search for all those methods and functions but I'd recommend starting with http://www.dotnetperls.com which is much easier to grasp.

p.s. Not C++ (as you keep stressing), but C#.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).