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.

Control multiple orders
 Post subject: Control multiple orders Post rating: 0   New post Posted: Tue 26 Feb, 2013, 23:55 

User rating: 0
Joined: Mon 31 Dec, 2012, 15:03
Posts: 5
I would like to open more than one order and apply different close strategies. What is the best way to implement it?
Currently I have two ideas:
1) use list and add every new order / delete close order. The main problem here is synchronization.
2) use order unique for every strategy label. The main problem here is parsing.
Is there any other way? Could you please give me some tips?


 
The Best Answer  Post subject: Re: Control multiple orders Post rating: 1   New post Posted: Wed 27 Feb, 2013, 08:29 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
dikson8080 wrote:
1) use list and add every new order / delete close order.
2) use order unique for every strategy label. The main problem here is parsing.
See:
https://www.dukascopy.com/wiki/#Order_Management/Maintain_order_list
dikson8080 wrote:
The main problem here is synchronization.
What do you mean here by synchronization?


 
 Post subject: Re: Control multiple orders Post rating: 0   New post Posted: Wed 27 Feb, 2013, 09:32 

User rating: 0
Joined: Mon 31 Dec, 2012, 15:03
Posts: 5
API Support wrote:
What do you mean here by synchronization?

I mean the same situation: is for some reason order was not opened/closed correctly (I think it's not a good reason if use OnMessage) I believe something other may happens (sorry my experience in Java and Forex not so deep fore a wail). In that situation my list will be different from real opened/closed orders.
The other point, what is very important for me it's: I would like to have two strategies for open and two for close orders. Depend on the open strategy I have to apply the close strategy (I do not what to cut it for two strategies because there are some dependency between strategies) In that case I have to mark order and (as I found in the link which you gave me: "In many strategies the strategy itself identifies its own orders by label prefix or by comment, ...") in result I have to support list of the current orders and recognize an order label. And here is a logical entrance: why do I need to support the list of the orders if I have to mark and recognize orders. I think in my case the best way is to mark orders (assign special label). I believe this is the answer.
Thank you a lot for this link. I have not read this article to the end but it is looks very useful. If you have any other, please let me know.
PS: in situation when I use more than one strategy I have to have new account for every
strategy or simple to recognize orders (I got this idea to the end of the message :)).
Thank you one more time


 
 Post subject: Re: Control multiple orders Post rating: 0   New post Posted: Wed 27 Feb, 2013, 14:56 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
dikson8080 wrote:
is for some reason order was not opened/closed correctly (I think it's not a good reason if use OnMessage)
onMessage is exactly where you normally handle such situations, see:
https://www.dukascopy.com/wiki/#Manage_Order_State
dikson8080 wrote:
The other point, what is very important for me it's: I would like to have two strategies for open and two for close orders. Depend on the open strategy I have to apply the close strategy (I do not what to cut it for two strategies because there are some dependency between strategies) In that case I have to mark order and (as I found in the link which you gave me: "In many strategies the strategy itself identifies its own orders by label prefix or by comment, ...") in result I have to support list of the current orders and recognize an order label. And here is a logical entrance: why do I need to support the list of the orders if I have to mark and recognize orders. I think in my case the best way is to mark orders (assign special label). I believe this is the answer.
The approach how you manage the orders is up to you. If the strategy only works with its own-created orders then probably the most convenient way is the approach we suggested in our previous post. However, if the strategies may change any order, then using label prefixes can be more convenient.


 

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