In visual mode I could not observe it this time but i'm fairly sure I saw it happen during a test (& not on start)
In optimisation mode I could maybe find a pattern : if checkperiod is longer than or equal to fractalperiod the error appears, if check period is less then there is no error
here is an example code
public class testNotEnoughData implements IStrategy {
private IEngine engine;
private IIndicators indicators;
private IConsole console;
private IHistory history;
private IAccount account;
@Configurable("Instrument") public Instrument selectedInstrument = Instrument.EURUSD;
@Configurable("fractal Period") public Period fractalPeriod = Period.THIRTY_MINS;
@Configurable("check period") public Period checkPeriod = Period.TEN_MINS;
private int counter = 0;
private int delay = 0;
private int switchAfter = 100;
public void onStart(IContext context) throws JFException {
this.engine = context.getEngine();
this.indicators = context.getIndicators();
this.console = context.getConsole();
this.history = context.getHistory();
this.account = context.getAccount();
}
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
//CALCULATE FRACTALS
if (period.equals(checkPeriod) && instrument.equals(selectedInstrument)) {
++delay;
engine.submitOrder("test"+(++counter), instrument, OrderCommand.SELL, 0.1, 0, 0, 0, 0,0,"comment"+counter);
if (delay>switchAfter) {
fractalPeriod = Period.FIVE_MINS;
checkPeriod = Period.TEN_MINS;
}
double[] fracASK = indicators.fractal(instrument, fractalPeriod, OfferSide.ASK, 5, 5);
}
}
here is screen capture before delay reach switchAfter (100)
then after the period is changed (checkperiod becoming longer than fractal period)