/**
     * 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;
    }
    /**
     * 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;
    }
 /**
  * Rounds double value to two significant signs.
  *
  * @param val value to be rounded.
  * @return rounded double value.
  */
 private static double round2(double val) {
   return Math.floor(100 * val + 0.5) / 100;
 }