I am testing a strategy in the Historical Tester (Starting from 2008.01.07), and I am receiving the following messages:
2008-01-07_002319 - eurusd_m1_S_1_3_1382041142 ORDER_FILL_REJECTED - No liquidity at price specified order: CANCELED SELL 0.01 @ 1.4747
The strategy (I cannot provide the full strategy, as it is confidential) is doing some checks, and if the conditions are meet, we are submitting orders in the onTick() method.
This is the onTick() part where orders gets submitted:
public void onTick(Instrument instrument, ITick tick) throws JFException {
if (instrument.equals(selectedInstrument)) {
if (allowLongOrder) {
prevTick = history.getTick(instrument, 1);
prevBidPrice = prevTick.getBid();
currBidPrice = tick.getBid();
if ( (prevBidPrice >= longEMA21) && (currBidPrice <= longEMA21) ) {
reachedEMA21 = true;
printWTime("reachedEMA21. prevBidPrice=%.5f; currBidPrice=%.5f; longEMA21=%.5f", prevBidPrice, currBidPrice, longEMA21);
}
...
if (reachedEMA21) {
newLabel = createLabel(selectedPeriod, LONG);
printWTime("%s prepared for submit. currBidPrice=%.5f; takeProfitInPrice=%.5f", newLabel, currBidPrice, takeProfitInPrice);
engine.submitOrder(newLabel + "_" + (System.currentTimeMillis()/1000), instrument, OrderCommand.BUY, orderAmount, tick.getBid(), 0.0, slPrice, currBidPrice+takeProfitInPrice, 0, newLabel);
}
}
else if (allowShortOrder) {
prevTick = history.getTick(instrument, 1);
prevAskPrice = prevTick.getAsk();
currAskPrice = tick.getAsk();
if ( (prevAskPrice <= shortEMA21) && (currAskPrice >= shortEMA21) ) {
reachedEMA21 = true;
printWTime("reachedEMA21. prevAskPrice=%.5f; currAskPrice=%.5f; shortEMA21=%.5f", prevAskPrice, currAskPrice, shortEMA21);
}
...
if (reachedEMA21) {
newLabel = createLabel(selectedPeriod, SHORT);
printWTime("%s prepared for submit. currAskPrice=%.5f; takeProfitInPrice=%.5f", newLabel, currAskPrice, takeProfitInPrice);
engine.submitOrder(newLabel + "_" + (System.currentTimeMillis()/1000), instrument, OrderCommand.SELL, orderAmount, tick.getAsk(), 0.0, slPrice, currAskPrice-takeProfitInPrice, 0, newLabel);
}
}
}
}
And this is the message:
2013-10-17 20:19:05 2008-01-07_004158 - eurusd_m1_S_1_8_1382041142 ORDER_FILL_REJECTED - No liquidity at price specified order: CANCELED SELL 0.01 @ 1.4746
2013-10-17 20:19:05 2013-10-17_201902 - eurusd_m1_S_1_8 prepared for submit. currAskPrice=1.47460; takeProfitInPrice=0.01020
2013-10-17 20:19:05 2013-10-17_201902 - reachedEMA21. prevAskPrice=1.47450; currAskPrice=1.47460; shortEMA21=1.47459
2013-10-17 20:19:05 2008-01-07_004157 - eurusd_m1_S_1_7_1382041142 ORDER_FILL_REJECTED - No liquidity at price specified order: CANCELED SELL 0.01 @ 1.4746
2013-10-17 20:19:05 2013-10-17_201902 - eurusd_m1_S_1_7 prepared for submit. currAskPrice=1.47460; takeProfitInPrice=0.01020
2013-10-17 20:19:05 2013-10-17_201902 - reachedEMA21. prevAskPrice=1.47450; currAskPrice=1.47460; shortEMA21=1.47459
2013-10-17 20:19:05 2008-01-07_004155 - eurusd_m1_S_1_6_1382041142 ORDER_FILL_REJECTED - No liquidity at price specified order: CANCELED SELL 0.01 @ 1.4746
2013-10-17 20:19:05 2013-10-17_201902 - eurusd_m1_S_1_6 prepared for submit. currAskPrice=1.47460; takeProfitInPrice=0.01020
2013-10-17 20:19:05 2013-10-17_201902 - reachedEMA21. prevAskPrice=1.47450; currAskPrice=1.47460; shortEMA21=1.47459
2013-10-17 20:19:05 2008-01-07_004150 - eurusd_m1_S_1_5_1382041142 ORDER_FILL_REJECTED - No liquidity at price specified order: CANCELED SELL 0.01 @ 1.4746
2013-10-17 20:19:05 2013-10-17_201902 - eurusd_m1_S_1_5 prepared for submit. currAskPrice=1.47460; takeProfitInPrice=0.01020
2013-10-17 20:19:05 2013-10-17_201902 - reachedEMA21. prevAskPrice=1.47450; currAskPrice=1.47460; shortEMA21=1.47459
2013-10-17 20:19:04 2008-01-07_002328 - eurusd_m1_S_1_4_1382041142 ORDER_FILL_REJECTED - No liquidity at price specified order: CANCELED SELL 0.01 @ 1.4747
2013-10-17 20:19:04 2013-10-17_201902 - eurusd_m1_S_1_4 prepared for submit. currAskPrice=1.47470; takeProfitInPrice=0.01020
2013-10-17 20:19:04 2013-10-17_201902 - reachedEMA21. prevAskPrice=1.47460; currAskPrice=1.47470; shortEMA21=1.47467
2013-10-17 20:19:04 2008-01-07_002319 - eurusd_m1_S_1_3_1382041142 ORDER_FILL_REJECTED - No liquidity at price specified order: CANCELED SELL 0.01 @ 1.4747
2013-10-17 20:19:04 2013-10-17_201902 - eurusd_m1_S_1_3 prepared for submit. currAskPrice=1.47470; takeProfitInPrice=0.01020
2013-10-17 20:19:04 2013-10-17_201902 - reachedEMA21. prevAskPrice=1.47460; currAskPrice=1.47470; shortEMA21=1.47467
2013-10-17 20:19:04 2008-01-07_002310 - eurusd_m1_S_1_2_1382041142 ORDER_FILL_REJECTED - No liquidity at price specified order: CANCELED SELL 0.01 @ 1.4747
2013-10-17 20:19:04 2013-10-17_201902 - eurusd_m1_S_1_2 prepared for submit. currAskPrice=1.47470; takeProfitInPrice=0.01020
2013-10-17 20:19:04 2013-10-17_201902 - reachedEMA21. prevAskPrice=1.47460; currAskPrice=1.47470; shortEMA21=1.47467
2013-10-17 20:19:04 2008-01-07_002309 - eurusd_m1_S_1_1_1382041142 ORDER_FILL_REJECTED - No liquidity at price specified order: CANCELED SELL 0.01 @ 1.4747
2013-10-17 20:19:04 2013-10-17_201902 - eurusd_m1_S_1_1 prepared for submit. currAskPrice=1.47470; takeProfitInPrice=0.01020
2013-10-17 20:19:04 2013-10-17_201902 - reachedEMA21. prevAskPrice=1.47460; currAskPrice=1.47470; shortEMA21=1.47467
Question Nr1:
What do I do wrong here? Is that not possible to fill a SHORT order on the actual price of the tick.getAsk()?