Total count of active Positions (ActivePositions.Count)
Author: jlu_68
Creation Date: 3/22/2010 2:35 PM
profile picture

jlu_68

#1
It might already be posted, however, I cant seem to find the solution... Can someone tell me how to get the TOTAL Active Position count. It seems the ActivePosition.Count property is the count per symbol.. I need to get the count across a DataSet.
profile picture

Eugene

#2
It depends on how you code it and how you run it. For example, in a Rotational strategy ActivePositions.Count would represent the count across a DataSet.

The total active position count is available to PosSizers. Without using a PosSizer, you'll have to loop by DataSetSymbols to create a portfolio-level backtest in the manner of Symbol Rotation strategies, and run them in Single Symbol mode (the Strategy will do the portfolio backtest itself).
profile picture

jlu_68

#3
Eugene, Im running my script across a data set of symbols.
Im limiting the number of positions per symbol to 1 by the following line of code...

CODE:
Please log in to see this code.


But since Im running this across a dataset i want to find out the number of active positions current day across a dataset of symbols..

profile picture

Eugene

#4
Across a DataSet by looping in your Strategy code (see above) or by making Wealth-Lab run a portfolio backtest? Anyway, please see my edited message above.
profile picture

jlu_68

#5
Im using portfolio backtest..

Ok.. I will take a look..

Thanks..
profile picture

jlu_68

#6
Hi Eugene,

Ive been trying to play around with the code to get it to work, however, Im getting mixed results. Below is the code Im trying.. Is this the correct way to get active positions in a portfolio?

CODE:
Please log in to see this code.
profile picture

Eugene

#7
Almost, but you need to eliminate that IsLastPositionActive logic altogether. In a multi-position strategy, there's no need in logic applicable when working with single position.
profile picture

jlu_68

#8
ok thanks..
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).