I have initilized my backtest as so.

            // don't do any margin stuff
            SetBrokerageModel(Brokerages.BrokerageName.Default, AccountType.Cash);

            //Cash allocation
            SetCash(25000);

 

When I decide to make an order I check to see if I already have orders in place and that I have enough cash before setting the order as below.

                        // if we have not open orders for it already
                        decimal totalorders = 0.0m;

                        foreach (var v in Portfolio.Transactions.GetOpenOrders())
                        {
                            totalorders += slice[v.Symbol].Price * v.Quantity;
                        }

                        // if we have enough money to buy it
                        if (Portfolio.Cash - totalorders > 0.05m * 25000m)
                        {
                            SetHoldings(testbar.Symbol, 0.05);
                        }
 

When I run this locally using the open source Lean it works, but when I run it on Quantconnect it seems to not update the value of Portfolio.Cash and I end up making short orders.  How can I check to see if I have enough cash?