|
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.
order state immutable?! |
Marco
|
Post subject: order state immutable?! |
Post rating: 0
|
Posted: Wed 05 Jan, 2011, 10:28
|
|
User rating: -
|
Hi, after submitting an order with submitorder, I want to change the OfferSide of the stop-loss from bid to ask with: IOrder new_order = engine.getOrder(order_id); console.getOut().println(new_order); new_order.setStopLossPrice(stop, OfferSide.ASK); as described on https://www.dukascopy.com/wiki/index.php ... Loss_priceBut I always get the error: com.dukascopy.api.JFException: Order state immutable @ jforex.SendOrders.sendOrder(SendOrders.java:170) What does that mean? What might I be doing wrong? Also is there maybe a way to define the offerside for the stop-loss of an order right away with submitorder? Thank you, Daniel
|
|
|
|
 |
API Support
|
Post subject: Re: order state immutable?! |
Post rating: 0
|
Posted: Fri 07 Jan, 2011, 16:32
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Hi, You can change order after it is in the OPENED state, you can use the IOrder.waitForUpdate(long timeoutMills) method or IOrder.submitOrder() method with specifying a stop loss.
Please do not hesitate to contact us if you require further information.
|
|
|
|
 |
[mmayer]
|
Post subject: Re: order state immutable?! |
Post rating: 0
|
Posted: Tue 11 Jan, 2011, 10:06
|
|
User rating: 0
Joined: Tue 26 Jan, 2010, 22:57 Posts: 4
|
Okay so how do I add a stop-loss order to a long entry-order then that does trigger on the ask-side instead of the default bid-side for example? Or a short entry order with a stop-loss order attached that triggers on the bid-side instead of the default ask-side? With submitorder? If so, how?
|
|
|
|
 |
API Support
|
Post subject: Re: order state immutable?! |
Post rating: 0
|
Posted: Tue 18 Jan, 2011, 14:44
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
To set a stop loss price by ASK to a buy order you can use the IOrder.setStopLossPrice(double price, OfferSide side) method after the order is submitted. Please consider the following code: IOrder order = engine.submitOrder(getLabel(instrument), instrument, OrderCommand.BUY, lot); while (order.getState().equals(IOrder.State.CREATED)) { order.waitForUpdate(500); } if (order.getState().equals(IOrder.State.FILLED) || order.getState().equals(IOrder.State.OPENED)) { order.setStopLossPrice(stopLossPrice, OfferSide.ASK); }
|
|
|
|
 |
[mmayer]
|
Post subject: Re: order state immutable?! |
Post rating: 0
|
Posted: Wed 19 Jan, 2011, 08:46
|
|
User rating: 0
Joined: Tue 26 Jan, 2010, 22:57 Posts: 4
|
Support wrote: To set a stop loss price by ASK to a buy order you can use the IOrder.setStopLossPrice(double price, OfferSide side) method after the order is submitted. Please consider the following code: IOrder order = engine.submitOrder(getLabel(instrument), instrument, OrderCommand.BUY, lot); while (order.getState().equals(IOrder.State.CREATED)) { order.waitForUpdate(500); } if (order.getState().equals(IOrder.State.FILLED) || order.getState().equals(IOrder.State.OPENED)) { order.setStopLossPrice(stopLossPrice, OfferSide.ASK); }
Well that would require me to have Jforex running with a stratety all of the time, even when I have my orders placed. Is there no other way? It's possible by using the jforex order mask so it should also be possible with the API right?
|
|
|
|
 |
API Support
|
Post subject: Re: order state immutable?! |
Post rating: 0
|
Posted: Mon 24 Jan, 2011, 08:38
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
Currently it is not possible to specify a stop loss price side during the order submit in the API.
|
|
|
|
 |
[mmayer]
|
Post subject: Re: order state immutable?! |
Post rating: 0
|
Posted: Tue 01 Feb, 2011, 00:47
|
|
User rating: 0
Joined: Tue 26 Jan, 2010, 22:57 Posts: 4
|
Ok guys this was a misunderstanding on my side I guess. I found out that it actually really does work with waitForUpdate cheking for "open" state. I thought "open" means position open but it's just the order state once it's submitted.
Thanks for your help!
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|