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.

Problem with slippage
 Post subject: Problem with slippage Post rating: 0   New post Posted: Wed 27 Apr, 2011, 23:35 

User rating: 0
Joined: Wed 01 Dec, 2010, 03:00
Posts: 1
Hi,

I'm trying to test my strategy and have some problems with slippage...

I submit orders using the following code...

String label = ...
double amount = ...
double price = ...
double stopLossPrice = ...
double takeProfitPrice = ...

double slippage = 5;

engine.submitOrder(label, instrument, IEngine.OrderCommand.BUY, amount, price, slippage, stopLossPrice, takeProfitPrice);


and see following messages...

17:47:04 Wed Jan 05 23:59:44 UTC 2011 - placed order: BUY 0.001 @ 1.3329
17:47:04 Wed Jan 05 23:59:44 UTC 2011 - [ORDER_SUBMIT_OK] Order B_4_20110427174704 submitted - openPrice: 1.3329; takeProfit: 1.3339; stopLoss: 1.3299
17:47:04 Wed Jan 05 23:59:44 UTC 2011 - [ORDER_FILL_OK] Order B_4_20110427174704 filled at: 1.3157
17:47:04 Wed Jan 05 23:59:44 UTC 2011 - [ORDER_CLOSE_OK] Order B_4_20110427174704 closed at: 1.3156


so the order was submitted with the price equal to 1.3329 and slippage equal to 5 (in pips), but was filled at 1.3157 which is really far away from what it should be. Changing the slippage value to 0 makes absolutely no difference.

Could you please explain me why does this happen and how can I fix it.

best regards,
genga


 
 Post subject: Re: Problem with slippage Post rating: 0   New post Posted: Thu 09 Jun, 2011, 13:42 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The BUY order was filled at the best possible price available at the very moment (1.3157 is obviously better than 1.3329).
Mind that slippage only acts in the loss direction - it can't prevent order from being made for a better price.


 

Jump to:  

  © 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