In your code, you were submitting a StopMarket and a Limit order right after you submitted a MarketOrder. When you submit an order, the algorithm checks for buying power and, if the first order (buy market) was filled, it should always have buying power to sell.
I modified and simplified your code to be sure it only submits the sell orders after the buy market order is filled. Also, it now uses Transactions.CancelOpenOrders method to cancel the sell orders that are never filled. Previously we got two open orders when it liquidates the holding before market closes. With these modifications, we do not need to keep tracking of the order tickets (CurrentOrder, StopLossOrder, ProfitTakeOrder) and we can all use SetHoldings helper to buy the security.