@Override
	public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {

		// 1個でも注文があれば何もしない
		if (1 == engine.getOrders().size()) {
			return;
		}

		String label = "Buy" + System.currentTimeMillis();

		IOrder orderByLabel = engine.getOrder(label);

		if (null != orderByLabel) {
			return;
		}

		IOrder order = engine.submitOrder(
				label,
				Instrument.USDJPY,// instrument 通貨ペア
				OrderCommand.BUY,
				0.01,// amount 単位
				askBar.getClose(),// 金額
				0,// slippage スリッページ
				askBar.getClose() - 1,// 損切り
				askBar.getClose() + 0.05// 利食い
				);

		 // while (order.getState() == IOrder.State.CREATED || order.getState() == IOrder.State.OPENED) {
		// order.waitForUpdate(2, TimeUnit.SECONDS);
		// }

		 if (order.getState() == IOrder.State.FILLED) {
			System.out.println(order.getOpenPrice() + " : " + order.getStopLossPrice() + " : " + order.getTakeProfitPrice());
		}

		 if (order.getState() == IOrder.State.CANCELED) {
			order = null;
		}
	}