Hello. I am trying to make strategy that only run on specific username. I try this code :
package jforex;
import java.util.*;
import com.dukascopy.api.*;
import com.dukascopy.api.IEngine.OrderCommand;
import com.dukascopy.api.IIndicators.AppliedPrice;
import com.dukascopy.api.IBar;
import com.dukascopy.api.IAccount;
import com.dukascopy.api.IAccount.AccountState;
public class Tes2 implements IStrategy {
private IAccount account;
private IEngine engine;
private IConsole console;
private IHistory history;
private IContext context;
private IIndicators indicators;
private IUserInterface userInterface;
private String User;
public void onStart(IContext context) throws JFException {
this.engine = context.getEngine();
this.console = context.getConsole();
this.history = context.getHistory();
this.context = context;
this.indicators = context.getIndicators();
this.userInterface = context.getUserInterface();
}
public void onAccount(IAccount account) throws JFException {
account = context.getAccount();
User = "DEMO10037gQxAbEU";
if (account.getUserName() == User) {
console.getOut().println("Strategy Run");
} else {
console.getOut().println("This Strategy doesn't belong to this account");
context.stop();
}
}
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 {
}
}
But the strategy stops although User == account.getUserName(). Can anyone help me?
Thank you