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.

Startup issues
 Post subject: Startup issues Post rating: 0   New post Posted: Tue 25 Mar, 2014, 10:52 
User avatar

User rating: 0
Joined: Fri 17 Jan, 2014, 18:13
Posts: 72
Location: NetherlandsNetherlands
Hi there.

I'm new here and new at Java. I can program just about anything with MQL4 and cAlgo (as well as PHP, JavaScript, Pascal, Ruby etc.), but cannot get one single line running in jForex. This is what the Wiki has to offer for starter. Beneath is the error that is generated.

package jforex;
import com.dukascopy.api.*;

public class Strategy1 implements IStrategy {
    public void onStart(IContext context) throws JFException {}
    public void onAccount(IAccount account) throws JFException {}
    public void onMessage(IMessage message) throws JFException {}
    public void onStop() throws JFException {}
    public void onTick(Instrument instr, ITick tick) throws JFException {}
}


09:47:00 ----------
09:47:00 The type Strategy1 must implement the inherited abstract method IStrategy.onBar(Instrument, Period, IBar, IBar)
09:47:00 ^^^^^^^^^
09:47:00 public class Strategy1 implements IStrategy {
09:47:00 2. ERROR in /Users/MacPro/JForex/MacPro/jfxide/tmp/compile/SemperRiskMan.java (at line 4)


What's wrong with me?


 
 Post subject: Re: Startup issues Post rating: 2   New post Posted: Tue 25 Mar, 2014, 19:20 
User avatar

User rating: 96
Joined: Mon 09 Sep, 2013, 07:09
Posts: 287
Location: Ukraine, SHostka
The shoterst strategy is
package jforex;
import com.dukascopy.api.*;
public class Strategy implements IStrategy {
    public void onStart(IContext context) throws JFException {}
    public void onAccount(IAccount account) throws JFException {}
    public void onMessage(IMessage message) throws JFException {}
    public void onStop() throws JFException {}
    public void onTick(Instrument instrument, ITick tick) throws JFException {}
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {}
}
Wiki is incomplete sometimes.

And let me give you a piece of advice: use some IDE.


 
 Post subject: Re: Startup issues Post rating: 0   New post Posted: Wed 26 Mar, 2014, 14:19 
User avatar

User rating: 164
Joined: Mon 08 Oct, 2012, 10:35
Posts: 676
Location: NetherlandsNetherlands
Hi,

There is an article series that can help you with the first steps: https://www.dukascopy.com/fxcomm/fx-arti ... ead&id=847

As hebasto pointed out, using an IDE also helps, as it can track/identify/fix errors for you. The wiki page that describes how to setup an IDE: https://www.dukascopy.com/wiki/#Use_in_Eclipse

Good luck!


 

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