public double calculateMaximumDrawdown() { double bal = openingBalance; double low = bal; double high = bal; double maxDD = 0.0; for (Order order : orders) { bal += order.getProfitLoss(); if (bal > high) { high = bal; low = bal; } else if (bal < low) { low = bal; } double dd = high - low; if (dd > maxDD) { maxDD = dd; } } return maxDD; }
public double calculateProfitForAllOrders() { double value = 0.0; for (Order order : orders) { value += order.getProfitLoss(); } return value; }
public int losses() { int count = 0; for (Order order : orders) { if (order.getProfitLoss() < 0.0) { count++; } } return count; }