t closedPositions = history.filter(position => 
                position && position.action === 'CLOSE' && 
                position.realizedProfit !== null && position.realizedProfit !== undefined);
            
            if (closedPositions.length === 0) {
                $('#totalProfitDisplay').text('0.00');
                $('#winRateDisplay').text('0%');
                return;
            }
            
            // 計算總損益
            let totalProfit = 0;
            let winCount = 0;
  