I would like to run my backtest using position sizing as the minimum of either:

- Percent of portfolio equity
- n% of the signal days turnover (volume * close).

I know there is a setting in the Backtester Settings dialog box but I'm not happy with using this as I need to control this behaviour programmatically. I'd prefer not calling the CBT procedure if possible. Any suggestions?

#2 can be easily expressed as number of shares.

When you specify spsPercentOfEquity in your `SetPositionSize()`

call, AmiBroker uses that value to calculate the number of shares to purchase. Therefore, it follows that you just need to do a little algebra to convert YOUR number of shares into a value expressed as a percentage of equity.

Once you have both #1 and #2 expressed in the same terms (percentage of equity), then the `min()`

calculation is trivial.

Sorry, I was mistaken. Since you don't have the equity value available, you can't put both values in the same terms. I believe you would have to use a CBT to impose the position size limitation.

I suspected that might be the case. Thanks Matt.