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.

How to add a custom Java Class to my Strategy
 Post subject: How to add a custom Java Class to my Strategy Post rating: 0   New post Posted: Tue 09 Jul, 2013, 05:18 

User rating: 0
Joined: Tue 09 Jul, 2013, 04:58
Posts: 1
Hi,

I am trying to develop a strategy and for the purposes of simplification, I am creating a custom Java class that will handle some of the functions. Because i didnt know any better I made a blank strategy file and started adding code as you would a normal Java class file. However when i try to create an object from my class in my main strategy file it does not seem to recognize it. i get the

"CandleIdentifier cannot be resolved to type" error, where CandleIdentifier is my custom class.

How would i go about linking these to files. Thank You


 
 Post subject: Re: How to add a custom Java Class to my Strategy Post rating: 0   New post Posted: Tue 09 Jul, 2013, 07:26 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please provide an example strategy which represents the problem.


 
 Post subject: Re: How to add a custom Java Class to my Strategy Post rating: 0   New post Posted: Tue 09 Jul, 2013, 12:08 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
I know that this is not what you have asked (as you want to separate the strategy's file and your class's file), but if the class is not that big, you can also embed it in the strategy class, like this:
public class Strategy1 implements IStrategy {
...
    private class myClass {

    }

    public void onStart(final IContext context) throws JFException {
...
}


 

Jump to:  

cron
  © 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