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
Size:
Color:
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.
Size:
Color:
Thank you. Can you tell me how I can have the right number of shares for an alert in a portfolio simulation ?
Size:
Color:
Not in a Strategy. Only Visualizers and PosSizers have access to the number of shares in a Portfolio Simulation.
Size:
Color:
Ok. It's clear for me now. Thank you !
Size:
Color: