Portfolio-wide ActivePositions.Count
Author: gbullr
Creation Date: 4/2/2012 12:59 PM
profile picture

gbullr

#1
Is there an object that keeps track of the number of positions in a portfolio? Thanks.

profile picture

Eugene

#2
A wise man's question contains half the answer. As the title of your post has the answer, it's self-contained. Impressive!

But my gut feel tells me it's not that simple? ;)
profile picture

gbullr

#3
ActivePositions.Count seems to keep the number of positions in the same STOCK. not the number of positions in different stocks/tickers/securities held in aportfolio.


An indirect way of answering the same question is 1/Pct of equity allocated to trades.

profile picture

Eugene

#4
It's amazing how useful the title/content forum search feature can be:

ActivePositions.Count

The title looks familiar, isn't it? ;)
profile picture

gbullr

#5
I am lazy... I will agree... but not that lazy. Just did not find this..

Thanks. once again.
profile picture

Eugene

#6
I am lazy. I don't like to type twice, so I create FAQs and use search too.

Should Gordon Gekko be a programmer, he would then proclaim that laziness is good. ;)

profile picture

gbullr

#7
If I may suggest PortfolioPositions.Count for a future version of WL.

profile picture

Eugene

#8
Here's how a portfolio simulation works: Strategies are pre-executed with 1 share in Raw Profit mode, then the position sizing overlay kicks in. Does your Strategy really needs the number of positions across different tickers in a portfolio? As mentioned in the linked thread, the actual number of portfolio positions is available to PosSizers (or to Strategies operating in a "rotational" manner i.e. looping by DataSetSymbols).


profile picture

Eugene

#9
Also, you might find helpful this design pattern created by Cone:

Portfolio-wide variables - Cone 1/15/2009 11:33 AM

The idea is to convert your Strategy into one that runs on a single symbol and by virtue of the DataSetSymbols loop, has the access to what you coined the "PortfolioPositions.Count".
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).