spsValue (=1) - dollar value of size (as in previous versions)
spsPercentOfEquity (=2) - size expressed as percent of portfolio-level equity (size must be from ..100 (for regular accounts) or .1000 for margin accounts)
Please tell me how with above setting I can limit maximum number of shares to buy?
OK, a simple example.
Ticker ABC = price 100 USD per 1 share
Initial equity 1000 USD
Let' say initial number of shares to buy is set to 50% of total equity.
So with first trade, we buy 5 shares of ABC ticker => total value 500 = 50% of current equity.
If your equity during backtest grows, let's say it will be 100.000, then we would buy 500 shares of ABC ticker (assuming price at that point will be the same). But I would like to add a restriction to code, to limit max number of shares to let's say 250 shares!
It's a trivial question, however I am not able to find a solution to it.