I've started to see these messages while I am try to calculate stochRSI in the Historical Tester. These exceptions only appearing during the first couple of calls of onBar().
When running the test on last year's data, the exceptions appearing till the bar 21:00 is being processed. After that everything runs normal, without the exceptions.
I think I am doing exactly the same things I've used to do in the past (around February). Was anything changed in the way the Historical Tester must be used?
A simple strategy that replicates the issues:
package jforex;
import java.util.*;
import com.dukascopy.api.*;
import com.dukascopy.api.IIndicators.AppliedPrice;
import com.dukascopy.api.IIndicators.MaType;
public class Strategy1 implements IStrategy {
private IEngine engine;
private IConsole console;
private IHistory history;
private IContext context;
private IIndicators indicators;
private IUserInterface userInterface;
@Configurable("Instrument")
public Instrument selectedInstrument = Instrument.EURUSD;
@Configurable("Period")
public Period selectedPeriod = Period.THIRTY_MINS;
@Configurable("sRSI Time Period")
public int timePeriod = 14;
@Configurable("sRSI Fast K Period")
public int fastKPeriod = 5 ;
@Configurable("sRSI Fast D Period")
public int fastDPeriod = 3;
@Configurable("Applied Price")
public AppliedPrice appliedPrice = AppliedPrice.CLOSE;
@Configurable("Indicator Filter")
public Filter indicatorFilter = Filter.WEEKENDS;
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 {
}
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 {
IBar prevBar;
double[][] stochRSI;
if ( (instrument.equals(selectedInstrument)) && (period.equals(selectedPeriod))) {
prevBar = history.getBar(instrument, selectedPeriod, OfferSide.BID, 1);
console.getOut().println("prevBar:" + prevBar);
stochRSI = indicators.stochRsi(instrument, selectedPeriod, OfferSide.BID, appliedPrice, timePeriod, fastKPeriod, fastDPeriod, MaType.SMA, indicatorFilter, 1, prevBar.getTime(), 1);
}
}
}
A sample of the output messages:
Note: the last messages were printed first. So till I start processing bar 21:00 on a 30M chart, these exceptions are present.
2014-09-08 18:39:27 prevBar:1378108800000[2013-09-02 08:00:00.000+0000] O: 1.32103 C: 1.3211 H: 1.32176 L: 1.32069 V: 5945.57
2014-09-08 18:39:27 prevBar:1378107000000[2013-09-02 07:30:00.000+0000] O: 1.32223 C: 1.32103 H: 1.32241 L: 1.32093 V: 6907.73
2014-09-08 18:39:27 prevBar:1378105200000[2013-09-02 07:00:00.000+0000] O: 1.32165 C: 1.32223 H: 1.3227 L: 1.32163 V: 6648.08
2014-09-08 18:39:27 prevBar:1378103400000[2013-09-02 06:30:00.000+0000] O: 1.32167 C: 1.32165 H: 1.32243 L: 1.32142 V: 4461.0
2014-09-08 18:39:27 prevBar:1378101600000[2013-09-02 06:00:00.000+0000] O: 1.32103 C: 1.32168 H: 1.32213 L: 1.32102 V: 4240.31
2014-09-08 18:39:27 prevBar:1378099800000[2013-09-02 05:30:00.000+0000] O: 1.32058 C: 1.32104 H: 1.3214 L: 1.32058 V: 1969.74
2014-09-08 18:39:27 prevBar:1378098000000[2013-09-02 05:00:00.000+0000] O: 1.32013 C: 1.32058 H: 1.32058 L: 1.32009 V: 1460.54
2014-09-08 18:39:27 prevBar:1378096200000[2013-09-02 04:30:00.000+0000] O: 1.32056 C: 1.32013 H: 1.3207 L: 1.31965 V: 2179.25
2014-09-08 18:39:27 prevBar:1378094400000[2013-09-02 04:00:00.000+0000] O: 1.32071 C: 1.32057 H: 1.32108 L: 1.32057 V: 979.73
2014-09-08 18:39:27 prevBar:1378092600000[2013-09-02 03:30:00.000+0000] O: 1.32061 C: 1.32071 H: 1.321 L: 1.32039 V: 1750.3
2014-09-08 18:39:27 prevBar:1378090800000[2013-09-02 03:00:00.000+0000] O: 1.32034 C: 1.32061 H: 1.32077 L: 1.32025 V: 1928.56
2014-09-08 18:39:27 prevBar:1378089000000[2013-09-02 02:30:00.000+0000] O: 1.32037 C: 1.32034 H: 1.32039 L: 1.32006 V: 1025.01
2014-09-08 18:39:26 prevBar:1378087200000[2013-09-02 02:00:00.000+0000] O: 1.3209 C: 1.32035 H: 1.32091 L: 1.32009 V: 1374.53
2014-09-08 18:39:26 prevBar:1378085400000[2013-09-02 01:30:00.000+0000] O: 1.32051 C: 1.32091 H: 1.32104 L: 1.32027 V: 1788.86
2014-09-08 18:39:26 prevBar:1378083600000[2013-09-02 01:00:00.000+0000] O: 1.31971 C: 1.32052 H: 1.32062 L: 1.31971 V: 1900.89
2014-09-08 18:39:26 prevBar:1378081800000[2013-09-02 00:30:00.000+0000] O: 1.31955 C: 1.31972 H: 1.31973 L: 1.31914 V: 1902.82
2014-09-08 18:39:26 prevBar:1378080000000[2013-09-02 00:00:00.000+0000] O: 1.32067 C: 1.31954 H: 1.32081 L: 1.31929 V: 1848.96
2014-09-08 18:39:26 prevBar:1378078200000[2013-09-01 23:30:00.000+0000] O: 1.32064 C: 1.32067 H: 1.32101 L: 1.32052 V: 831.95
2014-09-08 18:39:26 prevBar:1378076400000[2013-09-01 23:00:00.000+0000] O: 1.3201 C: 1.32065 H: 1.32065 L: 1.31965 V: 682.6
2014-09-08 18:39:26 prevBar:1378074600000[2013-09-01 22:30:00.000+0000] O: 1.32124 C: 1.3201 H: 1.32133 L: 1.31998 V: 1317.49
2014-09-08 18:39:26 prevBar:1378072800000[2013-09-01 22:00:00.000+0000] O: 1.32127 C: 1.32123 H: 1.32141 L: 1.3208 V: 668.78
2014-09-08 18:39:26 prevBar:1378071000000[2013-09-01 21:30:00.000+0000] O: 1.32073 C: 1.32131 H: 1.32146 L: 1.32065 V: 212.77
2014-09-08 18:39:26 prevBar:1378069200000[2013-09-01 21:00:00.000+0000] O: 1.32108 C: 1.32073 H: 1.3215 L: 1.3203 V: 300.84
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378067400000(2013-09-01 20:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378065600000(2013-09-01 20:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378063800000(2013-09-01 19:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378062000000(2013-09-01 19:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378060200000(2013-09-01 18:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378058400000(2013-09-01 18:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378056600000(2013-09-01 17:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378054800000(2013-09-01 17:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378053000000(2013-09-01 16:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378051200000(2013-09-01 16:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378049400000(2013-09-01 15:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378047600000(2013-09-01 15:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378045800000(2013-09-01 14:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378044000000(2013-09-01 14:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378042200000(2013-09-01 13:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378040400000(2013-09-01 13:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378038600000(2013-09-01 12:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378036800000(2013-09-01 12:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378035000000(2013-09-01 11:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378033200000(2013-09-01 11:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378031400000(2013-09-01 10:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378029600000(2013-09-01 10:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378027800000(2013-09-01 09:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378026000000(2013-09-01 09:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378024200000(2013-09-01 08:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378022400000(2013-09-01 08:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378020600000(2013-09-01 07:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378018800000(2013-09-01 07:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378017000000(2013-09-01 06:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378015200000(2013-09-01 06:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378013400000(2013-09-01 05:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378011600000(2013-09-01 05:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378009800000(2013-09-01 04:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378008000000(2013-09-01 04:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378006200000(2013-09-01 03:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378004400000(2013-09-01 03:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:26 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:26 prevBar:{T:1378002600000(2013-09-01 02:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:25 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:25 prevBar:{T:1378000800000(2013-09-01 02:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:25 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:25 prevBar:{T:1377999000000(2013-09-01 01:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:25 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:25 prevBar:{T:1377997200000(2013-09-01 01:00:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:25 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:25 prevBar:{T:1377995400000(2013-09-01 00:30:00.000+0000) E:false O:1.32208 C:1.32208 L:1.32208 H:1.32208 V:0.0}
2014-09-08 18:39:25 Strategy tester: java.lang.ArrayIndexOutOfBoundsException
2014-09-08 18:39:25 prevBar:1377993600000[2013-09-01 00:00:00.000+0000] O: 1.32208 C: 1.32208 H: 1.32208 L: 1.32208 V: 0.0
Please give me a hint about what to do.