/**
     * Updates this bar with next bar.
     *
     * @param bar Next bar.
     */
    public synchronized void update(Bar bar) {
      if (open == 0) open = bar.open;

      high = Math.max(high, bar.high);
      low = Math.min(low, bar.low);
      close = bar.close;
    }
    /**
     * Updates this bar with last price.
     *
     * @param price Price.
     */
    public synchronized void update(double price) {
      if (open == 0) open = price;

      high = Math.max(high, price);
      low = Math.min(low, price);
      close = price;
    }