Is there a way to reference positions by index number other than enumerating all positions and tagging, as in:
CODE:
Please log in to see this code.
Even with that, I would have to create a loop to select a specific position....
    
 
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Sure there is. Firstly, instead of 
foreach you could use 
for loop. But even this is unnecessary as each Position is tagged. You just have to call 
IndexOf of a Position object:
CODE:
Please log in to see this code.
     
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Thank you. The IndexOf property sounds like what I was looking for. I can't find any documentation on ways to use it, although I found a couple of code samples using it with apparent lists. Is this a generic property that can be applied to all lists in WL? Is Positions is a special type of list and that's why it supports this property?
I see now how I can get an Int reference for a specific Position. How can I go the other way and reference positions, e.g. to get the average Net Profit or number of bars held for the last 3 positions?
    
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        I think I figured it out. Thanks for setting me in the right direction.
CODE:
Please log in to see this code.
     
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        I believe
CODE:
Please log in to see this code.
will 
always hold true for a numerable C# collection such as Positions, so you don't need the 
.IndexOf property call. Calling that property unnecessarily will only slow you down. The 
.IndexOf property is available to all numerable C# collection types. Check the Microsoft .NET framework docs concerning C# collections.
Now you can change/redefine the numeration order of a C# collection such as Positions, say through an inverse sort, but WL 6.X.X isn't doing that with the Positions object.
    
 
    
        
    
    
        
    
    
        Size:  
    
        Color:  
    
    
 
    
        
     
    
        
    
 
    
    
    
        Thanks! C# coding is not my forte. Appreciate the lesson.
    
    
        
    
    
        
    
    
        Size:  
    
        Color: