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.

Close All Orders
 Post subject: Close All Orders Post rating: 0   New post Posted: Sat 11 Dec, 2010, 18:45 
User avatar

User rating: 0
Joined: Tue 07 Dec, 2010, 10:51
Posts: 39
Hey,

I'm not sure how the code should look like to close all opened orders. Can anyone please give me an example...

Thanks!


 
 Post subject: Re: Close All Orders Post rating: 0   New post Posted: Sat 11 Dec, 2010, 19:29 
User avatar

User rating: 0
Joined: Tue 07 Dec, 2010, 10:51
Posts: 39
I know I should use :

engine.closeOrders(orders);

But not sure what to put in the variable "orders"


 
 Post subject: Re: Close All Orders Post rating: 0   New post Posted: Sun 12 Dec, 2010, 16:59 

User rating: 0
Joined: Fri 25 Jun, 2010, 12:48
Posts: 12
private void closeAll() throws JFException {
        for (IOrder order : engine.getOrders()) {
            if (order.getState() == IOrder.State.FILLED) {
                order.close();
                order.waitForUpdate(2000);
            }
        }
        return;
    }


This code will close all FILLED order. Just change FILLED with what you need.


 
 Post subject: Re: Close All Orders Post rating: 0   New post Posted: Sun 12 Dec, 2010, 17:49 
User avatar

User rating: 0
Joined: Tue 07 Dec, 2010, 10:51
Posts: 39
androw95220 wrote:
private void closeAll() throws JFException {
        for (IOrder order : engine.getOrders()) {
            if (order.getState() == IOrder.State.FILLED) {
                order.close();
                order.waitForUpdate(2000);
            }
        }
        return;
    }


This code will close all FILLED order. Just change FILLED with what you need.


Thanks a million!


 
 Post subject: Re: Close All Orders Post rating: 0   New post Posted: Mon 13 Dec, 2010, 09:39 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hi,
please consider also this https://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=5&t=2119&p=3667&hilit=close#p3667


 

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