Dukascopy
 
 
Wiki JStore Search Login

Exception in Historical Tester
 Post subject: Exception in Historical Tester Post rating: 0   New post Posted: Wed 27 Apr, 2011, 22:58 

User rating: 0
Joined: Thu 02 Sep, 2010, 05:01
Posts: 49
Hi Support,
I pasted in OnStart method the following lines:

        Set subscribedInstruments = context.getSubscribedInstruments();
        subscribedInstruments.add(Instrument.EURUSD);
        context.setSubscribedInstruments(subscribedInstruments);
 


the strategy compiles; then I tried to backtesting it and I received in Historical Tester the following
Exception:

21:44:51 Strategy tester: java.lang.UnsupportedOperationException @ FrankStrategy_2011_05.onStart(FrankStrategy_2011_05.java:58)

the line 58 is
        subscribedInstruments.add(Instrument.EURUSD);
 


Best regards,
Frank


 
 Post subject: Re: Exception in Historical Tester Post rating: 0   New post Posted: Thu 28 Apr, 2011, 08:10 
User avatar

User rating: 8
Joined: Wed 21 Apr, 2010, 10:42
Posts: 1167
In Historical Tester you simply have to click the currencies that you're subscribing to. Hardcoded version will not work.


 
 Post subject: Re: Exception in Historical Tester Post rating: 0   New post Posted: Thu 28 Apr, 2011, 22:38 

User rating: 0
Joined: Fri 03 Sep, 2010, 10:49
Posts: 11
Hello support,

I get the same Exception, and i enderstand your explanation, but i still have another question,
Is it really needed to have the following code in the strategy for it works in the remote servers?

Set subscribedInstruments = context.getSubscribedInstruments();
subscribedInstruments.add(Instrument.EURUSD);
context.setSubscribedInstruments(subscribedInstruments);

Because i don't have this peace of code in the past and my strategy runs good in the remote servers.

Thanks,

linnux


 
 Post subject: Re: Exception in Historical Tester Post rating: 0   New post Posted: Fri 29 Apr, 2011, 09:20 
User avatar

User rating: 8
Joined: Wed 21 Apr, 2010, 10:42
Posts: 1167
Yes, for May you need to have this peace of code.

The Remote Server subscribes to the currencies from the platform. But in May you will you Dukascopy Forex Community web-site to run your strategy. You will upload the strategy right from the web-site and you need to indicate the subscribed currencies in the strategy code.


 
 Post subject: Re: Exception in Historical Tester Post rating: 0   New post Posted: Fri 29 Apr, 2011, 15:35 

User rating: 0
Joined: Fri 03 Sep, 2010, 10:49
Posts: 11
Hello again,

I have this peace of code, a litle diferent from yours, but this work with the Historical Tester, could i use it instead the other, or this one don´t work in the remote servers?

Set<Instrument> instSet = new HashSet<Instrument>();
instSet.add(Instrument.NZDUSD);
context.setSubscribedInstruments(instSet);

Thanks,

linnux


 
 Post subject: Re: Exception in Historical Tester Post rating: 0   New post Posted: Mon 02 May, 2011, 16:36 

User rating: -
This is bit confusing dunno abut this and got stuck. The strategy is getting stopped by the remote server.


 
 Post subject: Re: Exception in Historical Tester Post rating: 0   New post Posted: Tue 03 May, 2011, 09:44 
User avatar

User rating: 8
Joined: Wed 21 Apr, 2010, 10:42
Posts: 1167
linnux wrote:
Hello again,

I have this peace of code, a litle diferent from yours, but this work with the Historical Tester, could i use it instead the other, or this one don´t work in the remote servers?

Set<Instrument> instSet = new HashSet<Instrument>();
instSet.add(Instrument.NZDUSD);
context.setSubscribedInstruments(instSet);

Thanks,

linnux



Yes, you can use this snippet. I think we might even recommend this snippet to everyone else because it does not give exception in the Historical Tester.


 

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