Please check this bug in Historical Tester.
/*
* This is a test programm only, do not use for trading!
* It checks getOrdersHistory(Instrument, long, long) of Interface IHistory
* At current JForex DEMO version 2.15 this throws an exception in History Tester
*
* (c) Stash GmbH Muenchen / Germany
* www.stash.de
* Author: Bernhard Schicht
* Email: [email protected]
*/
package jforex;
import java.util.*;
import com.dukascopy.api.*;
public class HistoryBug implements IStrategy {
private boolean firstRun = true;
private long startTime = 0;
private int counter = 0;
public void onTick(Instrument instrument, ITick tick) throws JFException {
if (firstRun){
startTime = tick.getTime();
firstRun = false;
}
counter++;
if (counter == 100){
print("calling getOrdersHistory function, startTime = "+startTime+", currentTickTime = "+tick.getTime());
try{
history.getOrdersHistory(instrument , startTime, tick.getTime());
}
catch (Exception e){
e.printStackTrace(console.getErr());
}
}
}
public void print(String text){
console.getOut().println(text);
}
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 { }
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();
}
private IEngine engine;
private IConsole console;
private IHistory history;
private IContext context;
private IIndicators indicators;
private IUserInterface userInterface;
}
If you run this strategy in Historical Tester it will throw
2012-03-30 10:35:37 at java.lang.Thread.run(Unknown Source)
2012-03-30 10:35:37 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
2012-03-30 10:35:37 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.actions.c.run(Unknown Source)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.actions.StrategyTesterAction.yk(Unknown Source)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.actions.StrategyTesterAction.yK(Unknown Source)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.agent.strategy.tester.b.a(Unknown Source)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.agent.strategy.tester.t.run(Unknown Source)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.agent.strategy.tester.b.a(Unknown Source)
2012-03-30 10:35:37 at jforex.HistoryBug.onTick(HistoryBug.java:35)
2012-03-30 10:35:37 at com.dukascopy.dds2.greed.agent.strategy.tester.al.getOrdersHistory(Unknown Source)
2012-03-30 10:35:37 java.lang.NullPointerException
Bug approved with JForex DEMO version
Dukascopy ver. 2.15
JForex API ver. 2.6.63