Пример #1
0
  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;
  }
Пример #2
0
  public double calculateProfitForAllOrders() {
    double value = 0.0;

    for (Order order : orders) {
      value += order.getProfitLoss();
    }

    return value;
  }
Пример #3
0
  public int losses() {
    int count = 0;

    for (Order order : orders) {
      if (order.getProfitLoss() < 0.0) {
        count++;
      }
    }

    return count;
  }