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.

How to read the position opened and filled price?
 Post subject: How to read the position opened and filled price? Post rating: 0   New post Posted: Mon 18 Sep, 2017, 02:14 
User avatar

User rating: 0
Joined: Sun 16 Apr, 2017, 06:56
Posts: 11
Location: Cayman Islands, Grand Cayman
Hi,

How can I read the position opened and position filled price? I need to read these after a position is filled. I tried to do with 'Last trade event. trade message position. open price' (while that is dynamic variable), but it never show me correct amount as its filled by 0.0 after position opened!

May please help me read position opened and filled price separately?

Thank you
Best regards


 
 Post subject: Re: How to read the position opened and filled price? Post rating: 1   New post Posted: Mon 18 Sep, 2017, 08:59 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
IOrder.getOpenPrice()

Returns entry level price for conditional orders in IOrder.State.CREATED and IOrder.State.OPENED state

or price at which order was filled for orders in IOrder.State.FILLED or IOrder.State.CLOSED states


 
 Post subject: Re: How to read the position opened and filled price? Post rating: 0   New post Posted: Tue 19 Sep, 2017, 01:17 
User avatar

User rating: 0
Joined: Sun 16 Apr, 2017, 06:56
Posts: 11
Location: Cayman Islands, Grand Cayman
hi,

thanks. but I did't fully understand this, is this IOrder.getOpenPrice() same as IOrder.State.OPENED() ?
And price of filled order is IOrder.State.FILLED() ?

May please write me an example line of code that put a order opened and filled price separately in a variable?

Can I use IF lo compare the onTick price with order filled price ?

thank you
best regards


 
 Post subject: Re: How to read the position opened and filled price? Post rating: 0   New post Posted: Tue 19 Sep, 2017, 07:56 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Here is an example


Attachments:
Strategy2.java [1.59 KiB]
Downloaded 155 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: How to read the position opened and filled price? Post rating: 0   New post Posted: Sun 15 Oct, 2017, 07:07 
User avatar

User rating: 0
Joined: Sun 16 Apr, 2017, 06:56
Posts: 11
Location: Cayman Islands, Grand Cayman
Dear Madam/Sir,

Thanks for reply. But actually below in your code, we have fill price is open price, while we have slippage, I have doubt about this. Are you able to tell me, when there is slippage, as open price and filled price is different, how can I get the order filled price and show this in your code example? If you want, please attach a new code example while you believe slippage make these open and fill price different?
--------
public void onMessage(IMessage message) throws JFException {
if(message.getType().equals(IMessage.Type.ORDER_SUBMIT_OK)) {
openPrice = message.getOrder().getOpenPrice();
console.getOut().println("requested open price "+ openPrice);
}
else if(message.getType().equals(IMessage.Type.ORDER_FILL_OK)) {
filledPrice = message.getOrder().getOpenPrice();
console.getOut().println("filled price "+ openPrice);
}
}
---------

Thank you
Best regards


 
 Post subject: Re: How to read the position opened and filled price? Post rating: 0   New post Posted: Mon 16 Oct, 2017, 08:41 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This is normal on demo


 

Jump to:  

cron
  © 1998-2024 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