I would like to check whether a position in a symbol is open. Obviously, I can iterate through ActivePositions and check each Position.Symbol.
CODE:
Please log in to see this code.
I assume there is a non-iterative way to do it using ActivePositions.Contains(??), but I don't know what to insert in the parenthesis, since the only information I have about the Position is the symbol.
Am I missing something, or do I have to resort to Linq?
Size:
Color:
Syntactic sugar aside, ultimately it boils down to iteration. Your code is OK.
ActivePositions.Contains can be used to look up a
specific Position instance - which is not what you want.
Note that without a (potential) rewrite of your Strategy this cannot be used to check if there are active positions in a DataSet in Portfolio Simulation mode:
Any Open Position (in Other Symbols) in Portfolio Mode
Size:
Color:
Thanks Eugene.
I'm just trying to learn how to be a better programmer.
Size:
Color: