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.

IEngine.getOrders() fail to return all the orders when two orders with same label was opened
 Post subject: IEngine.getOrders() fail to return all the orders when two orders with same label was opened Post rating: 0   New post Posted: Fri 25 Jan, 2013, 15:36 

User rating: 0
Joined: Thu 06 Dec, 2012, 11:38
Posts: 5
Location: ChinaChina
I found a problem when I was designing a two-VPS Mutual Backup System using jforex. The aim of the system is to run two-copy of the same strategy

on two VPS. If one of the VPS is down due to some reason, another VPS will garantee the Strategy can be executed rightly.

In this system, two strategy copies will send two pending orders with same label by same statements

String label = "testlabel";
t = engine.submit(Orderlabel, Instrument.EURUSD, IEngine.OrderCommand.BUYSTOP, 0.01, tick.getBid() + 0.1 , 10, 0, 0);

at the same time.


If one strategy submit two orders with same label in a row, the later order will be rejected by dukascopy server, and an exception will be catch

by the strategy. But if the two orders are submited to the server by two strategy copies at the same time, the server will accept the two orders.

The two orders with the same label "testlabel" can be watched in jforex platform after they are opened.

So, I have to get the orders by the statements
List<IOrder> orders = null;
orders = engine.getOrders();
in order to close the later redundant order opened with the same label.

But the returned orders contain only one of these two orders with same label, if the statements mentioned above was placed in the OnTick()

function. In the jforex platform, we can find both the the two orders with same label "testlabel" in the Orders Tab.

And I found that if I stoped the strategy and restart it, the orders returned will contain all the orders listed in the Orders Tab in the jforex

platform.

My question is how to get all the orders without restarting the strategy? Is there a function can do this job?


 
 Post subject: Re: IEngine.getOrders() fail to return all the orders when two orders with same label was opened Post rating: 0   New post Posted: Wed 30 Jan, 2013, 09:56 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We could not replicate this, please provide both the example strategy and the precise launch case.


 
 Post subject: Re: IEngine.getOrders() fail to return all the orders when two orders with same label was opened Post rating: 0   New post Posted: Wed 30 Jan, 2013, 18:53 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
I thought concurrently live order labels had to be unique ?
.. oh, I read your thing more carefully, and you're using multiple strategies...
HyperScalper


 

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