ActivePositions collection
Author: ss161
Creation Date: 10/20/2009 10:26 AM
profile picture

ss161

#1
Below is the description of the ActivePositions collection from the QuickRef. I have a few questions / items I'd like to confirm:

1. the collection object only contains positions that are currently open? I'm assuming that when a position is either sold or covered, the corresponding item from this collection is deleted. obviously, this is in contrast to the Positions object that maintains all positions.

2. if I want to reference the "oldest" open position, I can refer directly to ActivePositions[ 0 ] -- instead of looping backwards through the collection looking for the earliest PositionEntryDate.

it seems like this is how it should work, but the documentation below says to check the Active property of each position -- which seems like it should be done if iterating through the Positions object but should not be necessary for this one.

Thanks.

Steve




QUOTE:
ActivePositions Property
IList<Position> ActivePositions

Returns the number of Positions that are currently still active. Use the Positions property to access the collection of actual Positions, and check the Active property of each Position to determine if it is active or not.


--------------------------------------------------------------------------------

Example
CODE:
Please log in to see this code.


profile picture

Eugene

#2
#1 - true, contains currently open positions.
#2 - true, you may safely use ActivePositions[0].
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).