Dear Support,
I have a strategy and I call executeTask from onTick, but the order is not submitted. Nothing happens. No exception, no message comes in onMessage and no order is submitted. Do you have any idea what should I check?
Here is the Callable object:
private class BuyTask implements Callable<IOrder>{
private IRule rule;
private IHistory history;
public BuyTask(IRule rule, IHistory history ){
this.rule = rule;
this.history = history;
}
@Override
public IOrder call() throws Exception {
double sl = rule.getStopLoss();
double tp = rule.getDefaultTargetProfit();
log("BUY - LABEL: " + rule.getName()+" PRICE: " +history.getLastTick(rule.getInstrument()).getBid()+" SL: " + sl + " TP: " + tp);
return engine.submitOrder( "BUY_" + rule.getStopLoss(),
rule.getInstrument(),
IEngine.OrderCommand.BUY,
1, // TODO: Adjust according to equity and risk
history.getLastTick(rule.getInstrument()).getBid(),
slippage,
sl,
tp);
}
}
and here is the call from onTick:
if(selectedRule == null ) return;
if(selectedRule.postEval(tick) == RuleSignal.BUY){
BuyTask bt = new BuyTask(selectedRule, history );
this.context.executeTask(bt);
}
if(selectedRule.postEval(tick) == RuleSignal.SELL){
SellTask st = new SellTask(selectedRule, history );
this.context.executeTask(st);
}
According to log message before submit, the input parameters of submit are valid. (no exception, no message in onMessage)
I am using DEMO account.
Regards,
Kirilla