API Support wrote:
Provide full example strategy of yours and describe which part you can't figure out how to implement.
OK!this is my code ..I want to modify the openPrice every ten seconds...
But the results have remained unchanged,please tell me where is the problem?
import com.dukascopy.api.*;
public class ModifyLimitOrderWithMessages implements IStrategy {
private IConsole console;
private IEngine engine;
private IHistory history;
private IOrder order;
public void onStart(IContext context) throws JFException {
engine = context.getEngine();
console = context.getConsole();
history = context.getHistory();
ITick tick = history.getLastTick(Instrument.EURUSD);
double openPrice = tick.getBid() + 0.0020;
double slippage = 1;
order = engine.submitOrder("order1" , Instrument.EURUSD, IEngine.OrderCommand.BUYSTOP_BYBID, 0.001, openPrice, slippage);
console.getOut().println(String.format("%s, amount=%s, open price=%s",order.getLabel(), order.getAmount(), order.getOpenPrice()));
order.waitForUpdate(2000);
while(slippage>0)
order.setOpenPrice(openPrice+0.002);
order.waitForUpdate(10000);
}