Is there an object that keeps track of the number of positions in a portfolio? Thanks.
Size:
Color:
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? ;)
Size:
Color:
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.
Size:
Color:
It's amazing how useful the title/content forum search feature can be:
ActivePositions.CountThe title looks familiar, isn't it? ;)
Size:
Color:
I am lazy... I will agree... but not that lazy. Just did not find this..
Thanks. once again.
Size:
Color:
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. ;)
Size:
Color:
If I may suggest PortfolioPositions.Count for a future version of WL.
Size:
Color:
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).
Size:
Color:
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".
Size:
Color: