How can capital and position size be used in portfolio simulation?
Author: minourat
Creation Date: 7/30/2010 11:42 PM
profile picture

minourat

#1
I want to obtain the number of the shares assigned to the positions
when a strategy is executed. I accessed Position.Shares, but it is
always 1. I also want to read the capital specified.
profile picture

Eugene

#2
Yes, what you see is by design and mentioned in the QuickRef entry of the Position.Shares property.

The way Wealth-Lab builds a portfolio simulation, it first collects all the raw trades and in the next round, applies position sizing to this collection, determining the final size. This is why the number of shares isn't available when a strategy is being executed. However, it's always available to PosSizers (and Visualizers), so you can access it in your custom position sizing rules like the API manual on creating a PosSizer instructs:

Wealth-Lab Version 5 (.NET) Development Guide

P.S. There's an unsupported way of Interacting Dynamically with Portfolio Level Equity that involves the Community.Components extension. If you dig a little deeper in this undocumented stuff, you could find the number of shares when a Strategy is executed too.
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).