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.
Size:
Color:
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 GuideP.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.
Size:
Color: