Number of shares in an alert is always 1 in the Portfolio simulation mode : Why ?
Author: abegy
Creation Date: 4/17/2012 11:11 PM
profile picture

abegy

#1
When I add the following code in a public strategy (for example : Scalper QQQ & Stocks), the result is strange for me.
With a Raw Profit mode, I have the correct number of share but in a Portfolio Simulation mode, I have all the time only 1 as the result.
I put a capital of 1000000 with a fixed dollar to 5000.


CODE:
Please log in to see this code.


What is wrong ?
Thanks for your help
profile picture

Eugene

#2
By design. Nothing is wrong. As stated in the QuickRef (have you looked up Alerts.Shares?) on multiple occasions,
QUOTE:
In portfolio simulation mode, all trades are pre-executed using 1 share per Position, and then position sizing is applied after the fact. So the Shares property will always return 1 while the Strategy is executing.
profile picture

abegy

#3
Thank you. Can you tell me how I can have the right number of shares for an alert in a portfolio simulation ?
profile picture

Eugene

#4
Not in a Strategy. Only Visualizers and PosSizers have access to the number of shares in a Portfolio Simulation.
profile picture

abegy

#5
Ok. It's clear for me now. Thank you !
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).