I could not help but notice a strange behaviour while running a jforex local strategy.
The local strategy sometimes crashes with values returned by the alligator, since it seemingly returns an array of null. The basic code is as follows
public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {
if (period == Period.FIVE_MINS && instrument == Instrument.EURUSD ){
double[] resultAlligator = indicators.alligator(instrument,period, OfferSide.BID, IIndicators.AppliedPrice.CLOSE,13, 8, 5, 0);
BigDecimal alli1;
BigDecimal alli2;
BigDecimal alli3;
try{
alli1 = new BigDecimal(result[0]);
alli2 = new BigDecimal(result[1]);
alli3 = new BigDecimal(result[2]);
}
catch (java.lang.NumberFormatException e){
console.getOut().println( "java.lang.NumberormatException: " +result[0] +" " +result[1] +" " + result[2] );
return false;
}
//do something else
}
}
This will log:
Quote:
04:30:01 java.lang.NumberormatException: NaN NaN NaN
04:35:00 java.lang.NumberormatException: NaN NaN NaN
and so on
this happens on the live environment, but only with a live run overnight. The historic tester does not show this behaviour.
If it occured, restarting the strategy does not help, but it will run as expected when the jforex client is stopped and restartet