consider the following
onStart method:
private Instrument instrument = Instrument.EURUSD;
private IConsole console;
private IHistory history;
@Override
public void onStart(IContext context) throws JFException {
this.console = context.getConsole();
this.history = context.getHistory();
console.getOut().println("Start");
// wait max 5 seconds for the tick to get loaded
ITick lastTick = history.getLastTick(instrument);
int i = 5;
while (lastTick == null) {
console.getOut().println("tick not loaded yet");
lastTick = history.getLastTick(instrument);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
console.getOut().println(e.getMessage());
}
i--;
}
}