I ran into a situation where SetHoldings didn't create MarketOrder because CalculateOrderQuantity returned 0. CalculateOrderQuantity returned 0 because there had been no Securities[symbol].Price set. I ended up checking the Quantity for the Holdings after calling SetHoldings, something like:

if (securitesToPurchase > 0) { SetHoldings("VCLT", 0.20m); var quantity = Securities["VCLT"].Holdings.Quantity; if (quantity > 0) { securtitiesToPurchase -= 1; } .... }

Is there a better way to do this?

-- Wink

Author