Thank you for the quick reply. Those variables look like they should solve the problem but I have noticed that they do not store the number of open lots, only the number of open trades. So if I buy 25 shares of one asset, NumOpenLong is now 1 instead of 25. After another buy of 25, NumOpenLong is 2. So it only returns the number of actual trades and doesn't account for the size of the trades.

Now that I know that it keeps track of open positions in Trades, I have found something that seems to work: for(current_trades) loops over the open trades of the current asset and I can sum up the TradeLots of each trade.