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 ORDER_CLOSE_OK showing brought price not closed
 Post subject: Problem with ORDER_CLOSE_OK showing brought price not closed Post rating: 0   New post Posted: Tue 17 Jan, 2012, 19:26 

User rating: 0
Joined: Sat 19 Nov, 2011, 01:24
Posts: 23
Location: United Kingdom,
if (message.getType().equals(IMessage.Type.ORDER_SUBMIT_OK)) {
out.print("Order created: " + message.getOrder());
} else if (message.getType().equals(IMessage.Type.ORDER_SUBMIT_REJECTED)) {
out.print("Order was not created: " + message.getOrder());
} else if (message.getType().equals(IMessage.Type.ORDER_FILL_OK)) {
out.print(message.getOrder()+" ");
} else if (message.getType().equals(IMessage.Type.ORDER_FILL_REJECTED)) {
out.print("Order canceled: " + message.getOrder());
} else if (message.getType().equals(IMessage.Type.ORDER_CLOSE_OK)){
out.print(" " + message.getOrder()+" ");
}

This above code gives when a trade is opened
18:20:44 FILLED BUY 0.0010 @ 1.22911
But when the trade closes it gives
18:20:44 CLOSED BUY 0.0010 @ 1.22911

The trade was closed at its take profit level of 1.23011

Is there something wrong with my code, or am I using the wrong code to get the close price?
If so what do I have to do to get the close price?


 
 Post subject: Re: Problem with ORDER_CLOSE_OK showing brought price not cl Post rating: 0   New post Posted: Wed 18 Jan, 2012, 09:42 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
IOrder.toString() implementation prints open price, if you want to log close price as well, then just add to the print statement: order.getClosePrice().


 

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