Position sizing based on target is done by self.SetHoldings() and self.CalculateOrderQuantity(), with the difference being CalculateOrderQuantity() is used with MarketOrder() while SetHoldings() just executes the trades. However, it is possible to determine the value of the Portfolio and based upon that calculate the size of the necessary order. Methods that could be useful in this case are Portfolio.Cash, Portfolio.MarginRemaining, Portfolio.TotalHoldingsValue, Portfolio.TotalPortfolioValue and Portfolio.GetBuyingPower. Please refer to "Securities and Portfolio" to see how how these can be used.
After calling these methods and some arithmetic the position size necessary be determined. With this position size an appropriate order can be made. Please refer to the "Trading and Orders" to see the various order types that can be used. Once creating the orders they can be accessed via Transactions methods such as Transactions.GetOpenOrders and Transactions.GetOrderById(int orderID. This way all orders can be tracked and individually handled, regardless of the overall positions. An idea would be to check a transaction record of open positions/filled orders so that it will be easier to determine which position to close later. The last link shows a sample algorithm where an order is created using Portfolio.MarginRemaining and basic arithmetic to determine the order size.
https://www.quantconnect.com/docs/algorithm-reference/securities-and-portfoliohttps://www.quantconnect.com/docs/algorithm-reference/trading-and-ordershttps://github.com/QuantConnect/Lean/blob/master/Algorithm.CSharp/CustomDataBitcoinAlgorithm.cs