Hi, this has had me stumped for awhile now, this is just a basic algorithm using a liquid universe; the issue I'm facing is that sometimes orders are getting cancelled before they get filled, and I can't figure out what the trigger is, so far it seems to be happening randomly.

for security in self.changes.RemovedSecurities:
if security.Invested:
self.Liquidate(security.Symbol)

for security in self.changes.AddedSecurities:
if not security.Invested:
self.SetHoldings(security.Symbol, 0.05)

The algorithm first liquidates securities that have been removed from the universe and then sends orders for securities that have been added to the universe. What's happening is the algorithm cancels the liquidation orders before sending the buy orders(I think). What's strange is this doesn't happen every time; I tried it with a 5 symbol universe, and this issue was basically non-existent over a 10 year period, but when I try a 20 symbol universe, the issue started popping up a lot within the same backtest period, no idea if there's a correlation there. 

I figure I'm missing something very obvious..