Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Submit JForex API bug reports in this forum only.
    Submit Converter issues in Converter Issues.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Strategy stops on exception
 Post subject: Strategy stops on exception Post rating: 0   New post Posted: Fri 17 Jan, 2014, 15:19 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
Platform 2.30.3
API 2.9.5.2

Platform stops a strategy regardless the 'Stop strategies on exception' option.
package jforex;

import com.dukascopy.api.*;

public class JFTestException implements IStrategy {
    private IContext context;
   
    public void onStart(IContext context) throws JFException {
        this.context = context;
        throw new JFException("jfxex");
    }
    public void onTick(Instrument instrument, ITick tick) throws JFException {}
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}
    public void onAccount(IAccount account) throws JFException {}
    public void onMessage(IMessage message) throws JFException {}
    public void onStop() throws JFException {
        context.getConsole().getOut().println("test end");
    }
}


Attachments:
JFTestException.java [706 Bytes]
Downloaded 92 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Strategy stops on exception Post rating: 0   New post Posted: Thu 23 Jan, 2014, 16:05 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
This has always worked that way. The feature works on all strategy methods but onStart, since the strategy is regarded as "started" only after successfully finishing the execution of the onStart method. This resonates with the strategy display in the workspace panel, where before finishing onStart the clock icon shows instead of the green "play" icon.


 
 Post subject: Re: Strategy stops on exception Post rating: 0   New post Posted: Thu 23 Jan, 2014, 17:57 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
API Support wrote:
This has always worked that way. The feature works on all strategy methods but onStart, since the strategy is regarded as "started" only after successfully finishing the execution of the onStart method. This resonates with the strategy display in the workspace panel, where before finishing onStart the clock icon shows instead of the green "play" icon.
It should be nice to document such behavior of the onStart method.


 

Jump to:  

  © 1998-2024 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