Take Profit

For Take Profit orders the same generalities as for Stop Loss orders do apply. There are two ways one can set the Take Profit price for an order:

  • by setting the Take Profit price upon order creation:
    engine.submitOrder("order", Instrument.EURUSD, OrderCommand.BUY, 0.001, 0, 20, 0, 1.2222);
  • or by modifying the existing order:
    IOrder order = engine.getOrder("order");
    order.setTakeProfitPrice(1.2222);

If the specified take profit price equals zero, Take Profit condition will not be applied. In the following example we remove a Take Profit condition from the existing order:

IOrder order = engine.getOrder("order");
order.setTakeProfitPrice(0);

The Take Profit price must be divisible by 0.1 pips otherwise the order will be rejected.

The information on this web site is provided only as general information, which may be incomplete or outdated. Click here for full disclaimer.