There is a flaw or timing problem in JForex3 Historical Tester. It misses trades at full speed in Visual mode.
Please run the following demonstration program in Historical Tester
from 06:40 12.12.2017 to 00:00 13.12.2017
in Visual mode
Show messages
It should place 2 entries at 12-12-2017 06:49:31.266 GMT
1) at full speed --> it misses the 2nd trade
2) at a slower speed than full speed, e.g.6x --> it enters both trades
3) uncomment "// this gets a fill" in the code and try it at full speed --> it enters both trades. The difference is the different TP only.
4) retry
not in Visual mode --> it enters both trades
5) retry in JForex2. It works there 100%, even at full speed.
It happens in Historical Tester at full speed only. I tested this in Forward run without a problem.
Bug found in JForex 3.2.21
/*
* This is a test programm only, do not use for trading!
* It checks submitOrder
* method of IEngine
*
* (c) Stash GmbH Muenchen / Germany, December 5th 2017
* https://www.stash.de
* Author: Bernhard Schicht
* Email: [email protected]
*/
package jforex;
import java.util.*;
import com.dukascopy.api.IEngine.*;
import com.dukascopy.api.*;
public class AnotherPlaceBidOfferBug implements IStrategy {
private IEngine engine;
private IConsole console;
private IHistory history;
private IContext context;
public void onStart(IContext context) throws JFException {
this.engine = context.getEngine();
this.console = context.getConsole();
this.context = context;
}
public void onAccount(IAccount account) throws JFException {
Set<Instrument> subscribe = new HashSet<Instrument>();
subscribe.add(Instrument.EURUSD);
context.setSubscribedInstruments(subscribe, true);
}
public void onMessage(IMessage message) throws JFException {
console.getOut().println("<html><font color=\"#2020FF\">message = "+message+"</font>");
}
public void onTick(Instrument instrument, ITick tick) throws JFException {
// at 12-12-2017 06:49:31.266 GMT
if (tick.getTime() == 1513061371266L){
// place bid order
IOrder longOrder = engine.submitOrder(
"Test_"+System.currentTimeMillis(),instrument,
OrderCommand.PLACE_BID,
0.01, 1.17780, 0, 1.17681, 1.17831, 0L);
context.getConsole().getOut().println("longOrder = " +longOrder);
// place another bid order
IOrder anotherLongOrder = engine.submitOrder(
"AnotherTest_"+System.currentTimeMillis(),instrument,
OrderCommand.PLACE_BID,
// 0.02, 1.17780, 20, 1.17681, 1.17831, 0L); // this gets a fill
0.02, 1.17780, 0, 1.17681, 1.17981, 0L); // this does NOT get filled!
context.getConsole().getOut().println("anotherLongOrder = " +anotherLongOrder);
}
}
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException { }
public void onStop() throws JFException { }
}