I have been having issues filling orders using SetHoldings with PortfolioTargets. I am frequently getting the error:

Backtest Handled Error: Order Error: id: 2042, Insufficient buying power to complete order (Value:5383.8783), Reason: Id: 2042, Initial Margin: 2694.784163303, Free Margin: 1658.964742388870114.

The strangest thing to me is sometimes this error comes in groups larger than ten, maybe around 30, even thought my list of portfolio targets is of size 10.

I am wondering why this error is occuring so often - even when I set self.Settings.FreePortfolioValuePercentage = 0.1.

I am also wondering how I can see significantly more than 10 of these errors in less than one month when in theory I should only be making at most 10 trades a month.

Lastly, as a bit of an unrelated question, by choosing stocks with the lowers DollarVolume, I noticed I get equities with DollarVolume less than 10 or 20. Does this mean only $10-$20 of that stock were traded the most recent day? If so, is it unreasonable to expect to be able to trade $1000 worth of that stock in a given day? Does the backtesting engine allow me to make unreasonable trades like this?  

Author