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.

Partial fill on take profit or stop loss
 Post subject: Partial fill on take profit or stop loss Post rating: 0   New post Posted: Sun 12 Aug, 2012, 16:44 

User rating: 0
Joined: Thu 09 Aug, 2012, 01:17
Posts: 9
Is it possible for take profit or stop loss to be hit and only partially filled/completed?

For instance if I have 100 units of USD/CAD and set a stop loss of -10 pips, and then price hits this mark, but there are only 50 units available on the market at that time. What happens in this situation? Conversely, what happens in the same situation but with a take profit set to +10 instead of a stop loss?


 
 Post subject: Re: Partial fill on take profit or stop loss Post rating: 0   New post Posted: Mon 13 Aug, 2012, 12:50 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
mikec1 wrote:
Is it possible for take profit or stop loss to be hit and only partially filled/completed?
Yes, the stop loss will get triggered on the filled part (of course if the price condition will have been reached).
  1. You submit order of amount 10.0 -> filled amount = 0, requested amount=10.0
  2. Happens partial fill -> filled amount = 2.2, requested amount=10.0
  3. SL gets triggered of full order amount -> filled amount = 0, requested amount=7.8
  4. Happens subsequent partial fill of 1.4 -> filled amount = 1.4, requested amount = 7.8
  5. Happens subsequent partial fill of 1.6 -> filled amount = 3.0, requested amount = 7.8
  6. SL gets triggered of 2.0 -> filled amount = 1.0, requested amount = 5.8
  7. etc.


 
 Post subject: Re: Partial fill on take profit or stop loss Post rating: 0   New post Posted: Thu 16 Aug, 2012, 21:29 

User rating: 0
Joined: Thu 09 Aug, 2012, 01:17
Posts: 9
In this case then, how can I use the API to determine the price that was used for each trade in the SL/TP execution (getClosePrice() will only tell you the most recent price, there could be multiple)


 
 Post subject: Re: Partial fill on take profit or stop loss Post rating: 0   New post Posted: Sat 25 Aug, 2012, 16:08 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
I would also like clarification on partial fills, and whether we will have more information and more control in the API. For example, changing an order's price when it is only partially filled seems to be prohibited. Sorry if I am wrong about this interpretation but that is how I understand it from the order state diagrams.


 
 Post subject: Re: Partial fill on take profit or stop loss Post rating: 0   New post Posted: Mon 27 Aug, 2012, 08:55 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
mikec1 wrote:
In this case then, how can I use the API to determine the price that was used for each trade in the SL/TP execution (getClosePrice() will only tell you the most recent price, there could be multiple)
You can collect those prices in onMessage on ORDER_CLOSE_OK message, while IOrder.State == FILLED


 
 Post subject: Re: Partial fill on take profit or stop loss Post rating: 0   New post Posted: Mon 27 Aug, 2012, 08:59 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
hyperscalper wrote:
For example, changing an order's price when it is only partially filled seems to be prohibited.
Yes, this is the case, however, you can cancel the unfilled part, see bottom-left corner of https://www.dukascopy.com/wiki/#Order_state/Conditional_order_states_diagram.
hyperscalper wrote:
I would also like clarification on partial fills, and whether we will have more information and more control in the API.
Please elaborate.


 
 Post subject: Re: Partial fill on take profit or stop loss Post rating: 0   New post Posted: Tue 11 Sep, 2012, 19:05 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
My main concern was with APICLIENT-276 IOrder.setOpenPrice for partially filled orders which is being evaluated. PLACE_BID and PLACE_OFFER order types are particularly vulnerable to sub micro partial fill amounts, which effectively disables our ability to adjust the price. Partial fills may occur with other order types, but it is much less probable, so I would request API control to adjust the order price on PLACE_BID or PLACE_OFFER order types, when they are only partially filled, so that we could eventually achieve a complete fill.

Perhaps the current restriction on adjusting price for all order types when in the (partially) FILLED state is something which could be lifted, so that would be permitted ? Of course we would respect the minimum order operations mandatory delays when adjusting price.


 
 Post subject: Re: Partial fill on take profit or stop loss Post rating: 0   New post Posted: Wed 12 Sep, 2012, 07:34 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please post in the original topic.


 

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