I am trying set 1% of my portfolio to each of 100 stocks.

Everyday I liquidate the whole portfolio and then set 1% to each stock.

If I understand correctly, looping through SetHoldings 100x and then setting 1% of my portfolio to each stock, I should never have unsufficient funds, but I am getting this error.

Example:

Liquidate();

for (i = 0; i< 100; i++)

{

SetHoldings(stock[i], .01);

}