There is a simple question:
What the line in my code does produce a take profit order?
My code:
package jforex;
import com.dukascopy.api.*;
import java.util.EnumSet;
public class FakeTakeProfit implements IStrategy {
public void onStart(IContext context) throws JFException {
Instrument instrument = Instrument.AUDCAD;
context.setSubscribedInstruments(EnumSet.of(instrument), true);
context.getEngine().submitOrder("label", instrument, IEngine.OrderCommand.BUY, 0.001).waitForUpdate(IOrder.State.FILLED);
context.stop();
}
public void onAccount(IAccount account) throws JFException {}
public void onMessage(IMessage message) throws JFException {}
public void onStop() throws JFException {}
public void onTick(Instrument instrument, ITick tick) throws JFException {}
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}
}
Messages Tab:
19:39:06 Order ACCEPTED: #219439229 TAKE PROFIT SELL 0.001 mil. AUD/CAD @ LIMIT 0.99298 IF BID => 0.99298 - Position #56024770
19:39:06 Strategy "FakeTakeProfit" is stopped at 2013-11-06 19:39:06.554 GMT on the local computer with no parameters. Reason: Stopped by Engine
19:39:06 Stopping "FakeTakeProfit" strategy at 2013-11-06 19:39:06.549 GMT on the local computer
19:39:06 Order FILLED at 0.99258 CAD (#219439227 BUY 0.001 mil. AUD/CAD @ MKT MAX SLIPPAGE 0.0005) - Position #56024770
19:39:06 Order ACCEPTED: #219439227 BUY 0.001 mil. AUD/CAD @ MKT MAX SLIPPAGE 0.0005 - Position #56024770
19:39:06 Order BUY 1000 AUD/CAD @ MKT is sent at 2013-11-06 19:39:06.353 GMT by the strategy "FakeTakeProfit": from the local computer
19:39:06 Strategy "FakeTakeProfit" Strategy ID: E114B5919ABA7F0DD5254070C13E6F33 is started at 2013-11-06 19:39:06.327 GMT on the local computer with no parameters
19:39:06 Starting "FakeTakeProfit" strategy at 2013-11-06 19:39:06.247 GMT on the local computer
DEMO account, ver. 2.28.4
Thank you all