Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

No liquidity at price specified order
 Post subject: No liquidity at price specified order Post rating: 0   New post Posted: Thu 17 Oct, 2013, 21:37 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
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()?


 
 Post subject: Re: No liquidity at price specified order Post rating: 0   New post Posted: Thu 17 Oct, 2013, 21:53 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Additionally, if I modify my submitOrder() function, and use 0.0 as price (so I replace the tick.getAsk(), tick.getBid() with 0.0), I also have a strange situation (at least for me). And this is what I got in that case:

Image

There are 4 orders on the screenshot, but let's analyze order #1: eurusd_m1_S_1_1_1382042533
This order gets filled around 2008.01.07_00:23:10.
At the moment the Ask price is 1.47470, the Bid price is 1.47450 (this is visible in the OHLC informer on the screenshot).
This is a SHORT order, so I would expect the order gets filled on the Ask price, which is 1.47470, but this is not the case.
The order gets filled on the Bid price, which is 1.4745 (the blue underline on the screenshot).

Question Nr#2:
Do I miss something about bid and ask prices, and that is normal that a SELL order's open price is the actual tick's Bid price?


Attachments:
File comment: Screenshot of the problem
Capture.PNG [73.05 KiB]
Downloaded 276 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: No liquidity at price specified order Post rating: 0   New post Posted: Mon 21 Oct, 2013, 14:50 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Quote:
Is that normal that a SELL order's open price is the actual tick's Bid price?

Could someone at least reply on this, please?


 
 Post subject: Re: No liquidity at price specified order Post rating: 1   New post Posted: Mon 21 Oct, 2013, 16:01 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
Quote:
Is that normal that a SELL order's open price is the actual tick's Bid price?
Yes, it is.
Traders as liquidity consumers (unlike liquidity providers, i.e. market makers) always buy at ask (higher) price and sell at bid (lower) price. The only exception given by Dukascopy are BID and OFFER orders which allow a trader to be a liquidity provider for internal Dukascopy's clients.
See more: https://www.dukascopy.com/wiki/files/dc_wiki_a4.pdf, page 10


 
 Post subject: Re: No liquidity at price specified order Post rating: 0   New post Posted: Tue 22 Oct, 2013, 16:01 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Could you please provide a proper case for this? A full example strategy which replicates the case plus a snapshot of your Historical Tester settings?


 
 Post subject: Re: No liquidity at price specified order Post rating: 0   New post Posted: Tue 22 Oct, 2013, 19:37 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
@hebasto:
Thanks for the information!

@support:
At this moment (based on the post of hebasto) I don't think I have a problem. If you have anything to add, that is much appreciated, of course...


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com