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.

A Question on onStop() of strategies in JForex-SDK
 Post subject: A Question on onStop() of strategies in JForex-SDK Post rating: 0   New post Posted: Thu 16 Aug, 2012, 14:57 

User rating: 0
Joined: Thu 16 Aug, 2012, 03:29
Posts: 26
Excuse me, everyone.

I met a problem when coding in JForex-SDK and wish you could give me a hand.

I used eclipse to import the project and replaced the username and password with my demo ones.

It runs well with the onStart() and onTick() functions in strategy Class.

However, I found that when I terminate the running project, it just comes to an end and the onStop() function is not called at all.

public void onStop() throws JFException {
        for (IOrder order : engine.getOrders()) {
            order.close();
        }
        console.getOut().println("Stopped");
    }


The statement "console.getOut().println("Stopped");" is not executed.

I was wondering whether you could help me out.

How could I make the onStop() function is called when the project is about to end?

Thank you so much!


 
The Best Answer  Post subject: Re: A Question on onStop() of strategies in JForex-SDK Post rating: 0   New post Posted: Thu 23 Aug, 2012, 13:41 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
In order for onStop() method to be executed you must call client.stopStrategy(); for the strategy before terminating Standalone client.


 
 Post subject: Re: A Question on onStop() of strategies in JForex-SDK Post rating: 0   New post Posted: Thu 06 Sep, 2012, 01:56 

User rating: 0
Joined: Thu 16 Aug, 2012, 03:29
Posts: 26
Thank you so much, API Support!


 

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