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.

Place Take Profit based upon Fill Price for Market Orders
 Post subject: Place Take Profit based upon Fill Price for Market Orders Post rating: 0   New post Posted: Thu 06 Sep, 2012, 21:03 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
This is a JForex platform enhancement request, so please move it to the appropriate area.

If I submit a Market order manually, in the JForex platform, it appears to calculate the Take Profit distance relative to the price at the time the order was submitted. For example, if 2.6 PIPS is specified as the default Take Profit distance, slippage might be 1 PIP and so the Take Profit price would be inaccurate relative to the FILL price, since the Take Profit appears to be calculated before the Market order is submitted.

Assume the Take Profit default is 2.6 pips.
Example, a BUY Market order is submitted and the ASK price is 1.2600 at the time of submission, so it appears the platform specifies the Take Profit price to be 2.6 pips higher, so TP = 1.26026 . However, the Market order may fill at 1.2601 due to slippage. So the Take Profit price would be inaccurate, relative to the Fill price.

Correct me if I'm wrong about this behavior.

Instead, it would be helpful if the JForex platform would submit the Take Profit distance based upon the FILL price of the Market order so that it would be more accurate. That's how I would do it with a Strategy module, since the Fill price of a Market order is subject to slippage.

I realize this would be additional processing, but it's a Feature Request. To implement this, the platform would have to wait for the Fill, and then apply the TP price based upon the Fill price.


 
 Post subject: Re: Place Take Profit based upon Fill Price for Market Orders Post rating: 0   New post Posted: Thu 06 Sep, 2012, 23:33 
User avatar

User rating: 94
Joined: Mon 06 Feb, 2012, 12:22
Posts: 357
Location: Portugal, Castelo Branco
Hi Hiperscalper:

One solution is with one strategy monitoring onMessage()... When the onMessage() receives the ORDER_FILL_OK, get the fill price, do the calculations and set the take profit.

I hope that helps

JL


 
 Post subject: Re: Place Take Profit based upon Fill Price for Market Orders Post rating: 0   New post Posted: Sat 08 Sep, 2012, 21:26 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
Thanks for that, but I do realize how to do it within a Strategy module. Was just requesting that the JForex platform do that itself, when assigning default TP distance, as a feature request so the TP price would be more accurate.

jlongo wrote:
Hi Hiperscalper:

One solution is with one strategy monitoring onMessage()... When the onMessage() receives the ORDER_FILL_OK, get the fill price, do the calculations and set the take profit.

I hope that helps

JL


 
 Post subject: Re: Place Take Profit based upon Fill Price for Market Orders Post rating: 0   New post Posted: Sat 21 Dec, 2013, 18:06 

User rating: 0
Joined: Thu 12 Dec, 2013, 09:24
Posts: 21
Location: Ukraine, Kyiv
Hello, can you tell me please how can I get Fill price? I don't see any function among methos of IOrder which could give me FillPrice. I see only getOpenPrice, but not sure does getOpenPrice = Fill price?


 
 Post subject: Re: Place Take Profit based upon Fill Price for Market Orders Post rating: 1   New post Posted: Sun 22 Dec, 2013, 10:43 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
docotor wrote:
Hello, can you tell me please how can I get Fill price? I don't see any function among methos of IOrder which could give me FillPrice. I see only getOpenPrice, but not sure does getOpenPrice = Fill price?
Yes, it does.
https://www.dukascopy.com/client/javadoc/com/dukascopy/api/IOrder.html#getOpenPrice%28%29
Just be sure that your order is in the FILLED state.


 

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